aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libiberty/ChangeLog5
-rw-r--r--libiberty/cplus-dem.c3
2 files changed, 7 insertions, 1 deletions
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index 0865428..5bd7715 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -1,3 +1,8 @@
+2016-10-31 Mark Wielaard <mjw@redhat.com>
+
+ * cplus-dem.c (ada_demangle): Initialize demangled to NULL and
+ XDELETEVEC demangled when unknown.
+
2016-10-17 Nick Clifton <nickc@redhat.com>
* Sync with gcc.
diff --git a/libiberty/cplus-dem.c b/libiberty/cplus-dem.c
index f954050..7f63397 100644
--- a/libiberty/cplus-dem.c
+++ b/libiberty/cplus-dem.c
@@ -911,7 +911,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)
@@ -1156,6 +1156,7 @@ ada_demangle (const char *mangled, int option ATTRIBUTE_UNUSED)
return demangled;
unknown:
+ XDELETEVEC (demangled);
len0 = strlen (mangled);
demangled = XNEWVEC (char, len0 + 3);