From: Dale Weiler Date: Sat, 13 Apr 2013 18:01:26 +0000 (+0000) Subject: Fix some memory leaks. X-Git-Tag: before-library~77 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=c74889f648b5f530831049ecc3a3db71db6e2db6;p=xonotic%2Fgmqcc.git Fix some memory leaks. --- diff --git a/ftepp.c b/ftepp.c index 68491ed..2337d5a 100644 --- 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 a28b07e..84455d5 100644 --- 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)