dyngen: Don't leak already malloc'ed demangled_name

This commit is contained in:
Alexander von Gluck IV
2012-06-30 22:54:06 -05:00
committed by Alexei Svitkine
parent fd78a64ade
commit 612761981f

View File

@@ -2885,8 +2885,10 @@ int gen_file(FILE *outfile, int out_type)
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;
}
fprintf(outfile, "#ifndef DEFINE_CST\n");
fprintf(outfile, "#define DEFINE_CST(NAME, VALUE)\n");