]> granicus.if.org Git - yasm/commitdiff
* bytecode.c (yasm_bc_destroy): Only xfree symrecs if non-NULL.
authorPeter Johnson <peter@tortall.net>
Sun, 5 Mar 2006 09:29:52 +0000 (09:29 -0000)
committerPeter Johnson <peter@tortall.net>
Sun, 5 Mar 2006 09:29:52 +0000 (09:29 -0000)
(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

libyasm/bytecode.c
modules/parsers/gas/gas-bison.y

index 6e2a47d226513d286a81632c1eb8157d2fba39cc..dae30af871d07e54207e3d5c2ef15b619b8d749d 100644 (file)
@@ -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);
 }
 
index 88348576d4a2aeea17b62866c9b837c2e031e529..cd3eb2139005bcd9c5321bf2b3301c7d8a06e103 100644 (file)
@@ -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) {