diff options
author | Andrew Burgess <aburgess@broadcom.com> | 2014-05-28 23:06:43 +0100 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2014-05-28 23:06:43 +0100 |
commit | 0aaa9a3aa1e68d309a4746633494b9a01a0575f5 (patch) | |
tree | 13bce4faedd4b19eb8fa802357df6e8c289c2061 /libiberty/cplus-dem.c | |
parent | 7f3c034326ce5d487e897826a12c3a4b9d457b49 (diff) | |
download | gdb-0aaa9a3aa1e68d309a4746633494b9a01a0575f5.zip gdb-0aaa9a3aa1e68d309a4746633494b9a01a0575f5.tar.gz gdb-0aaa9a3aa1e68d309a4746633494b9a01a0575f5.tar.bz2 |
cplus-demangler, free resource after a failed call to gnu_special.
libiberty/
2014-05-14 Andrew Burgess <aburgess@broadcom.com>
* cplus-dmem.c (internal_cplus_demangle): Free any resources
allocated by possible previous call to gnu_special.
(squangle_mop_up): Reset pointers to NULL after calling free.
* testsuite/demangle-expected: New test case.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@210425 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libiberty/cplus-dem.c')
-rw-r--r-- | libiberty/cplus-dem.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/libiberty/cplus-dem.c b/libiberty/cplus-dem.c index e948487..2dd0a8a 100644 --- a/libiberty/cplus-dem.c +++ b/libiberty/cplus-dem.c @@ -1175,6 +1175,11 @@ internal_cplus_demangle (struct work_stuff *work, const char *mangled) if ((AUTO_DEMANGLING || GNU_DEMANGLING)) { success = gnu_special (work, &mangled, &decl); + if (!success) + { + delete_work_stuff (work); + string_delete (&decl); + } } if (!success) { @@ -1218,10 +1223,12 @@ squangle_mop_up (struct work_stuff *work) if (work -> btypevec != NULL) { free ((char *) work -> btypevec); + work->btypevec = NULL; } if (work -> ktypevec != NULL) { free ((char *) work -> ktypevec); + work->ktypevec = NULL; } } |