diff options
author | Alan Modra <amodra@gmail.com> | 2025-01-01 22:52:51 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2025-01-01 22:52:51 +1030 |
commit | 0e4e9aa0a7727819a0b5b240617f8f4243c4c80f (patch) | |
tree | 046ae2fc062de5a89444b3a462510f643416a611 | |
parent | 822bda23f618286724e449815c8da8cde03e32e0 (diff) | |
download | gdb-0e4e9aa0a7727819a0b5b240617f8f4243c4c80f.zip gdb-0e4e9aa0a7727819a0b5b240617f8f4243c4c80f.tar.gz gdb-0e4e9aa0a7727819a0b5b240617f8f4243c4c80f.tar.bz2 |
objdump sym memory leak
The sym array should be freed even with a symcount of zero.
* objdump.c (dump_bfd): Free syms before replacing with
extra_syms. Free extra_syms after adding to syms.
-rw-r--r-- | binutils/objdump.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/binutils/objdump.c b/binutils/objdump.c index 478086a..ecbe39e 100644 --- a/binutils/objdump.c +++ b/binutils/objdump.c @@ -5730,6 +5730,7 @@ dump_bfd (bfd *abfd, bool is_mainfile) { if (old_symcount == 0) { + free (syms); syms = extra_syms; } else @@ -5739,6 +5740,7 @@ dump_bfd (bfd *abfd, bool is_mainfile) memcpy (syms + old_symcount, extra_syms, (symcount + 1) * sizeof (asymbol *)); + free (extra_syms); } } |