mirror of
https://github.com/kanjitalk755/macemu.git
synced 2025-08-15 11:27:35 +00:00
dyngen: Don't leak func_name if realloc fails
This commit is contained in:
committed by
Alexei Svitkine
parent
612761981f
commit
668b8f14ba
@@ -2942,9 +2942,11 @@ int gen_file(FILE *outfile, int out_type)
|
||||
int func_name_length = p - demangled_name;
|
||||
if (nd > nf) {
|
||||
nf = nd;
|
||||
if ((func_name = realloc(func_name, nf)) == NULL)
|
||||
if ((func_name = realloc(func_name, nf)) == NULL) {
|
||||
free(func_name);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
strncpy(func_name, demangled_name, func_name_length);
|
||||
func_name[func_name_length] = '\0';
|
||||
/* emit code generator */
|
||||
|
Reference in New Issue
Block a user