diff options
Diffstat (limited to 'libiberty/cplus-dem.c')
-rw-r--r-- | libiberty/cplus-dem.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libiberty/cplus-dem.c b/libiberty/cplus-dem.c index 84f94b6..6cd9a41 100644 --- a/libiberty/cplus-dem.c +++ b/libiberty/cplus-dem.c @@ -883,7 +883,7 @@ ada_demangle (const char *mangled, int option ATTRIBUTE_UNUSED) int len0; const char* p; char *d; - char *demangled; + char *demangled = NULL; /* Discard leading _ada_, which is used for library level subprograms. */ if (strncmp (mangled, "_ada_", 5) == 0) @@ -1129,10 +1129,11 @@ ada_demangle (const char *mangled, int option ATTRIBUTE_UNUSED) unknown: len0 = strlen (mangled); + free (demangled); demangled = XNEWVEC (char, len0 + 3); if (mangled[0] == '<') - strcpy (demangled, mangled); + strcpy (demangled, mangled); else sprintf (demangled, "<%s>", mangled); |