diff options
author | Pedro Alves <palves@redhat.com> | 2017-05-04 15:14:37 +0100 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2017-05-04 15:14:37 +0100 |
commit | 3c3ae77e68a9032ef9f174bf6b1cc992b6a4cb35 (patch) | |
tree | 424cbaa533c75fa1df717e6164245fff595efec0 /gdb/thread.c | |
parent | f91d48deb29d9e6f4b530f586db0140943ed0d83 (diff) | |
download | binutils-3c3ae77e68a9032ef9f174bf6b1cc992b6a4cb35.zip binutils-3c3ae77e68a9032ef9f174bf6b1cc992b6a4cb35.tar.gz binutils-3c3ae77e68a9032ef9f174bf6b1cc992b6a4cb35.tar.bz2 |
Fix get_core_register_section leak, introduce thread_section_name
This plugs a leak introduced in the previous change to
get_core_register_section, which removed an xfree call that is
actually necessary because the 'section_name' local is static.
From [1] it looks like the reason the variable was made static to
begin with, was just "laziness" to avoid having to think about freeing
it on every function return path:
https://sourceware.org/ml/gdb-patches/2005-03/msg00237.html
The easiest to fix that nowadays is to use a std::string.
I don't see a need to xstrdup the section name in the single-threaded
case though, and also there's more than one place that computes a
multi-threaded section name in the same way. So put the section name
computation in a wrapper class with state.
gdb/ChangeLog:
2017-05-04 Pedro Alves <palves@redhat.com>
* corelow.c (thread_section_name): New class.
(get_core_register_section, get_core_siginfo): Use it.
Diffstat (limited to 'gdb/thread.c')
0 files changed, 0 insertions, 0 deletions