From: Peter Johnson Date: Sun, 5 Mar 2006 09:29:52 +0000 (-0000) Subject: * bytecode.c (yasm_bc_destroy): Only xfree symrecs if non-NULL. X-Git-Tag: v0.5.0rc2~5^2~35 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a8871be6744f7a6aac593b393cc51bf813c1c270;p=yasm * bytecode.c (yasm_bc_destroy): Only xfree symrecs if non-NULL. (bc_align_destroy): Free boundary and maxskip (closing memory leaks). * gas-bison.y (gas_get_section): Don't strdup name, it's always passed in already strdup'ed/allocated (closes memory leak). svn path=/trunk/yasm/; revision=1403 --- diff --git a/libyasm/bytecode.c b/libyasm/bytecode.c index 6e2a47d2..dae30af8 100644 --- a/libyasm/bytecode.c +++ b/libyasm/bytecode.c @@ -865,8 +865,12 @@ static void bc_align_destroy(void *contents) { bytecode_align *align = (bytecode_align *)contents; + if (align->boundary) + yasm_expr_destroy(align->boundary); if (align->fill) yasm_expr_destroy(align->fill); + if (align->maxskip) + yasm_expr_destroy(align->maxskip); yasm_xfree(contents); } @@ -1255,7 +1259,8 @@ yasm_bc_destroy(yasm_bytecode *bc) if (bc->callback) bc->callback->destroy(bc->contents); yasm_expr_destroy(bc->multiple); - yasm_xfree(bc->symrecs); + if (bc->symrecs) + yasm_xfree(bc->symrecs); yasm_xfree(bc); } diff --git a/modules/parsers/gas/gas-bison.y b/modules/parsers/gas/gas-bison.y index 88348576..cd3eb213 100644 --- a/modules/parsers/gas/gas-bison.y +++ b/modules/parsers/gas/gas-bison.y @@ -845,7 +845,7 @@ gas_get_section(yasm_parser_gas *parser_gas, char *name, yasm_section *new_section; yasm_vps_initialize(&vps); - vp = yasm_vp_create(yasm__xstrdup(name), NULL); + vp = yasm_vp_create(name, NULL); yasm_vps_append(&vps, vp); if (!builtin) {