Fix memory leak of the demangled symbol name
commit57d750026550cf3a589e3f28a0cdc303ba5ed039
authorChristian Biesinger <cbiesinger@google.com>
Wed, 8 Jan 2020 01:10:40 +0000 (7 19:10 -0600)
committerChristian Biesinger <cbiesinger@google.com>
Thu, 9 Jan 2020 19:13:04 +0000 (9 13:13 -0600)
tree0f736a1162600cd6a325bde3cf012a7e0d865215
parentffebb0bbde7deae978ab3e4d3d3d90acf52b7d69
Fix memory leak of the demangled symbol name

compute_and_set_names would only free the name if we did not find the name
in the hashtable, but it needs to always free it.  Solve this by moving the
smart pointer outside the if.

Thanks to PhilippeW for finding this.

gdb/ChangeLog:

2020-01-09  Christian Biesinger  <cbiesinger@google.com>

* symtab.c (general_symbol_info::compute_and_set_names): Move the
unique_xmalloc_ptr outside the if to always free the demangled name.

Change-Id: Id7c6b8408432183700ccb5ff634818d6c5a3ac95
gdb/ChangeLog
gdb/symtab.c