Fix some memory leaks.

This commit is contained in:
Dale Weiler 2013-04-13 18:01:26 +00:00
parent a6ac90215b
commit c74889f648
2 changed files with 12 additions and 4 deletions

12
ftepp.c
View file

@ -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;
}
/**

4
ir.c
View file

@ -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)