winedump: Fix memory leak in msmangle.c (found by Smatch).

This commit is contained in:
Lionel Debroux 2007-09-01 15:09:34 +02:00 committed by Alexandre Julliard
parent caca06aa7f
commit e2fc6c35ce
1 changed files with 11 additions and 1 deletions

View File

@ -195,7 +195,7 @@ int symbol_demangle (parsed_symbol *sym)
free (function_name); free (function_name);
return -1; return -1;
} }
class_name = str_substring (class_name, name - 2); class_name = str_substring (class_name, name - 2); /* Allocates a new string */
} }
/* Function/Data type and access level */ /* Function/Data type and access level */
@ -218,6 +218,7 @@ int symbol_demangle (parsed_symbol *sym)
if (VERBOSE) if (VERBOSE)
printf ("/*FIXME: %s: unknown data*/\n", sym->symbol); printf ("/*FIXME: %s: unknown data*/\n", sym->symbol);
free (function_name); free (function_name);
free (class_name);
return -1; return -1;
} }
sym->flags |= SYM_DATA; sym->flags |= SYM_DATA;
@ -227,6 +228,7 @@ int symbol_demangle (parsed_symbol *sym)
sym->arg_text[0] = str_create (3, ct.expression, " ", sym->arg_name[0]); sym->arg_text[0] = str_create (3, ct.expression, " ", sym->arg_name[0]);
FREE_CT (ct); FREE_CT (ct);
free (function_name); free (function_name);
free (class_name);
return 0; return 0;
case '6' : /* compiler generated static */ case '6' : /* compiler generated static */
@ -242,9 +244,11 @@ int symbol_demangle (parsed_symbol *sym)
if (VERBOSE) if (VERBOSE)
puts ("Demangled symbol OK [vtable]"); puts ("Demangled symbol OK [vtable]");
free (function_name); free (function_name);
free (class_name);
return 0; return 0;
} }
free (function_name); free (function_name);
free (class_name);
return -1; return -1;
/* Functions */ /* Functions */
@ -289,6 +293,7 @@ int symbol_demangle (parsed_symbol *sym)
/* FIXME: G,H / O,P / W,X are private / protected / public thunks */ /* FIXME: G,H / O,P / W,X are private / protected / public thunks */
default: default:
free (function_name); free (function_name);
free (class_name);
return -1; return -1;
} }
@ -303,6 +308,7 @@ int symbol_demangle (parsed_symbol *sym)
case 'D': is_const = (CT_CONST | CT_VOLATILE); break; case 'D': is_const = (CT_CONST | CT_VOLATILE); break;
default: default:
free (function_name); free (function_name);
free (class_name);
return -1; return -1;
} }
} }
@ -334,6 +340,7 @@ int symbol_demangle (parsed_symbol *sym)
break; break;
default: default:
free (function_name); free (function_name);
free (class_name);
return -1; return -1;
} }
@ -349,6 +356,7 @@ int symbol_demangle (parsed_symbol *sym)
INIT_CT (ct); INIT_CT (ct);
if (!demangle_datatype (&name, &ct, sym)) { if (!demangle_datatype (&name, &ct, sym)) {
free (function_name); free (function_name);
free (class_name);
return -1; return -1;
} }
sym->return_text = ct.expression; sym->return_text = ct.expression;
@ -366,6 +374,7 @@ int symbol_demangle (parsed_symbol *sym)
INIT_CT (ct); INIT_CT (ct);
if (!demangle_datatype(&name, &ct, sym)) { if (!demangle_datatype(&name, &ct, sym)) {
free (function_name); free (function_name);
free (class_name);
return -1; return -1;
} }
@ -394,6 +403,7 @@ int symbol_demangle (parsed_symbol *sym)
*/ */
if (*name != 'Z') { if (*name != 'Z') {
free (function_name); free (function_name);
free (class_name);
return -1; return -1;
} }