Delete temporary string within demangler even in failure cases.
authorpalves <palves@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 11 Jun 2014 10:57:27 +0000 (10:57 +0000)
committerpalves <palves@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 11 Jun 2014 10:57:27 +0000 (10:57 +0000)
commitc9cbe29851d8e44c0cd433a14d53e70bb3e4de22
tree4d52113401587f99e543f605783372eabe76714c
parent1581f2d70893931e3240d5726d3be6fde1567606
Delete temporary string within demangler even in failure cases.

A call to demangle_template might allocate storage within a temporary
string even if the call to demangle_template eventually returns
failure.

This will never cause the demangler to crash, but does leak memory, as
a result I've not added any tests for this.

Calling string_delete is safe, even if nothing is allocated into the
string, the string is initialised with string_init, so we know the
internal pointers are NULL.

libiberty/ChangeLog

* cplus-dem.c (do_type): Call string_delete even if the call to
demangle_template fails.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@211449 138bc75d-0d04-0410-961f-82ee72b054a4
libiberty/ChangeLog
libiberty/cplus-dem.c