From 4d5ed807408b91038e504d14e91f48c124aaa34b Mon Sep 17 00:00:00 2001 From: Alexei Svitkine Date: Sun, 1 Jul 2012 13:52:45 -0400 Subject: [PATCH] dyngen: Fix more leaks. --- SheepShaver/src/kpx_cpu/src/cpu/jit/dyngen.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/SheepShaver/src/kpx_cpu/src/cpu/jit/dyngen.c b/SheepShaver/src/kpx_cpu/src/cpu/jit/dyngen.c index 549f5e2b..b6ead792 100644 --- a/SheepShaver/src/kpx_cpu/src/cpu/jit/dyngen.c +++ b/SheepShaver/src/kpx_cpu/src/cpu/jit/dyngen.c @@ -885,8 +885,10 @@ int load_object(const char *filename, FILE *outfile) char *demangled_name, *func_name; if ((demangled_name = malloc(nd)) == NULL) return -1; - if ((func_name = malloc(nf = nd)) == NULL) + if ((func_name = malloc(nf = nd)) == NULL) { + free(demangled_name); return -1; + } for(i = 0, sym = symtab; i < nb_syms; i++, sym++) { const char *name; @@ -914,6 +916,9 @@ int load_object(const char *filename, FILE *outfile) fprintf(outfile, "#endif\n"); } } + + free(func_name); + free(demangled_name); } return 0; }