diff --git a/libyasm/bytecode.c b/libyasm/bytecode.c index d3d039a2..6718431c 100644 --- a/libyasm/bytecode.c +++ b/libyasm/bytecode.c @@ -1156,6 +1156,8 @@ yasm_bc_create_insn(yasm_arch *arch, const unsigned long insn_data[4], insn->num_operands = num_operands; if (operands) insn->operands = *operands; /* structure copy */ + else + STAILQ_INIT(&insn->operands); insn->num_prefixes = 0; insn->prefixes = NULL; insn->num_segregs = 0; diff --git a/libyasm/section.c b/libyasm/section.c index 54d49b5f..12b63bd9 100644 --- a/libyasm/section.c +++ b/libyasm/section.c @@ -309,6 +309,10 @@ yasm_object_destroy(yasm_object *object) cur = next; } + /* Delete associated filenames */ + yasm_xfree(object->src_filename); + yasm_xfree(object->obj_filename); + /* Delete symbol table and line mappings */ yasm_symtab_destroy(object->symtab); yasm_linemap_destroy(object->linemap); diff --git a/modules/objfmts/elf/elf.c b/modules/objfmts/elf/elf.c index 84d50739..0734dff5 100644 --- a/modules/objfmts/elf/elf.c +++ b/modules/objfmts/elf/elf.c @@ -567,6 +567,8 @@ elf_secthead_destroy(elf_secthead *shead) if (shead == NULL) yasm_internal_error(N_("shead is null")); + yasm_intnum_destroy(shead->size); + yasm_xfree(shead); } diff --git a/modules/parsers/gas/gas-token.re b/modules/parsers/gas/gas-token.re index 247c8980..aa923634 100644 --- a/modules/parsers/gas/gas-token.re +++ b/modules/parsers/gas/gas-token.re @@ -137,7 +137,7 @@ fill(yasm_parser_gas *parser_gas, YYCTYPE *cursor) if(!s->eof){ size_t cnt = s->tok - s->bot; if(cnt){ - memcpy(s->bot, s->tok, (size_t)(s->lim - s->tok)); + memmove(s->bot, s->tok, (size_t)(s->lim - s->tok)); s->tok = s->bot; s->ptr -= cnt; cursor -= cnt; diff --git a/modules/parsers/nasm/nasm-token.re b/modules/parsers/nasm/nasm-token.re index 6d9f0064..e06ec2c8 100644 --- a/modules/parsers/nasm/nasm-token.re +++ b/modules/parsers/nasm/nasm-token.re @@ -62,7 +62,7 @@ fill(yasm_parser_nasm *parser_nasm, YYCTYPE *cursor) if(!s->eof){ size_t cnt = s->tok - s->bot; if(cnt){ - memcpy(s->bot, s->tok, (size_t)(s->lim - s->tok)); + memmove(s->bot, s->tok, (size_t)(s->lim - s->tok)); s->tok = s->bot; s->ptr -= cnt; cursor -= cnt;