diff options
author | Pedro Alves <palves@redhat.com> | 2019-01-10 17:52:38 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2019-01-10 17:52:38 +0000 |
commit | 36cb72375cc371b786ceaec588ec26f8c55ae2ec (patch) | |
tree | c0e9803a737866f7a77956e9181a5b62bac0ed87 /gdb/solib-target.c | |
parent | da584958006fd0a3f3dccd25a0a54fa79a0976bc (diff) | |
download | binutils-36cb72375cc371b786ceaec588ec26f8c55ae2ec.zip binutils-36cb72375cc371b786ceaec588ec26f8c55ae2ec.tar.gz binutils-36cb72375cc371b786ceaec588ec26f8c55ae2ec.tar.bz2 |
Fix leak in mdebugread.c
Coverity points out that all the "continue;" statements in the switch
case in parse_partial_symbols leak STABSTRING. This is because we
only release STABSTRING at the end of the scope, with:
if (stabstring
&& stabstring != debug_info->ss + fh->issBase + sh.iss)
xfree (stabstring);
but that bit of code is skipped if a case in the switch statement ends
with "continue".
Fix this by using gdb::unique_xmalloc_ptr to manage the heap-allocated
version of 'stabsstring'.
I don't know how to test this.
gdb/ChangeLog:
2019-01-10 Pedro Alves <palves@redhat.com>
* mdebugread.c (parse_partial_symbols): Use
gdb::unique_xmalloc_ptr to manage heap-allocated 'stabsstring'.
Diffstat (limited to 'gdb/solib-target.c')
0 files changed, 0 insertions, 0 deletions