aboutsummaryrefslogtreecommitdiff
path: root/libiberty
diff options
context:
space:
mode:
authorMichael Snyder <msnyder@vmware.com>2011-03-04 18:25:32 +0000
committerMichael Snyder <msnyder@vmware.com>2011-03-04 18:25:32 +0000
commit12f23c24faef13b3b0467c5cb5fa9ca99d8d1fd9 (patch)
tree93826a76c3bcb72967f6b8a80a26e13178ed940c /libiberty
parentb2c5f112feaa1cf93f36b77b1d056d5ff06b38c3 (diff)
downloadgdb-12f23c24faef13b3b0467c5cb5fa9ca99d8d1fd9.zip
gdb-12f23c24faef13b3b0467c5cb5fa9ca99d8d1fd9.tar.gz
gdb-12f23c24faef13b3b0467c5cb5fa9ca99d8d1fd9.tar.bz2
2011-03-04 Michael Snyder <msnyder@vmware.com>
* cplus-dem.c (ada_demangle): Stop memory leak. Also fix a one line indent problem.
Diffstat (limited to 'libiberty')
-rw-r--r--libiberty/ChangeLog5
-rw-r--r--libiberty/cplus-dem.c5
2 files changed, 8 insertions, 2 deletions
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index dc92638..2c1252f 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -1,3 +1,8 @@
+2011-03-04 Michael Snyder <msnyder@vmware.com>
+
+ * cplus-dem.c (ada_demangle): Stop memory leak.
+ Also fix a one line indent problem.
+
2011-02-28 Kai Tietz <kai.tietz@onevision.com>
* filename_cmp.c (filename_ncmp): New function.
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);