]> git.rm.cloudns.org Git - xonotic/gmqcc.git/commitdiff
Fix some memory leaks.
authorDale Weiler <killfieldengine@gmail.com>
Sat, 13 Apr 2013 18:01:26 +0000 (18:01 +0000)
committerDale Weiler <killfieldengine@gmail.com>
Sat, 13 Apr 2013 18:01:26 +0000 (18:01 +0000)
ftepp.c
ir.c

diff --git a/ftepp.c b/ftepp.c
index 68491ed6dd2af72e1c8e69035b6e48bce5384a35..2337d5a289792b8a00bce4622575cf08831a9d45 100644 (file)
--- a/ftepp.c
+++ b/ftepp.c
@@ -492,7 +492,7 @@ static bool ftepp_define(ftepp_t *ftepp)
             break;
         default:
             ftepp_error(ftepp, "expected macro name");
-            return false;
+            goto cleanup_false;
     }
 
     (void)ftepp_next(ftepp);
@@ -500,14 +500,14 @@ static bool ftepp_define(ftepp_t *ftepp)
     if (ftepp->token == '(') {
         macro->has_params = true;
         if (!ftepp_define_params(ftepp, macro))
-            return false;
+            goto cleanup_false;
     }
 
     if (!ftepp_skipspace(ftepp))
-        return false;
+        goto cleanup_false;
 
     if (!ftepp_define_body(ftepp, macro))
-        return false;
+        goto cleanup_false;
 
     if (ftepp->output_on)
         vec_push(ftepp->macros, macro);
@@ -518,6 +518,10 @@ static bool ftepp_define(ftepp_t *ftepp)
     for (; l < ftepp_ctx(ftepp).line; ++l)
         ftepp_out(ftepp, "\n", true);
     return true;
+
+cleanup_false:
+    ppmacro_delete(macro);
+    return false;
 }
 
 /**
diff --git a/ir.c b/ir.c
index a28b07e95f3452d5b68999a1005799fbd41480c9..84455d56a2d48dc0b72bdd31e44e9a699521dfc7 100644 (file)
--- a/ir.c
+++ b/ir.c
@@ -3292,6 +3292,8 @@ static void gen_vector_defs(prog_section_def def, const char *name)
         def.offset++;
         component[len-1]++;
     }
+
+    mem_d(component);
 }
 
 static void gen_vector_fields(prog_section_field fld, const char *name)
@@ -3320,6 +3322,8 @@ static void gen_vector_fields(prog_section_field fld, const char *name)
         fld.offset++;
         component[len-1]++;
     }
+
+    mem_d(component);
 }
 
 static bool ir_builder_gen_global(ir_builder *self, ir_value *global, bool islocal)