diff options
author | Alan Modra <amodra@gmail.com> | 2023-03-29 09:13:17 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2023-03-29 12:56:46 +1030 |
commit | 647744420e69bf5fc8f5ab88a9d7dabd6087a890 (patch) | |
tree | 16a447220f6a684dc2018ea1d2016a6f4b1ab8fb /bfd | |
parent | 3901d7da4eef4bd362e5c20189d0dc44c07d168b (diff) | |
download | gdb-647744420e69bf5fc8f5ab88a9d7dabd6087a890.zip gdb-647744420e69bf5fc8f5ab88a9d7dabd6087a890.tar.gz gdb-647744420e69bf5fc8f5ab88a9d7dabd6087a890.tar.bz2 |
Re: Fix an aout memory leak
We have way too much duplicated code in bfd. Apply dd3a3d0af9f6 and
920581c57e08 to pdp11.c.
* pdp11.c (bfd_free_cached_info): Free line_buf. Return true
if tdata.aout_data is NULL.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/pdp11.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/bfd/pdp11.c b/bfd/pdp11.c index 862cf49..9edbba9 100644 --- a/bfd/pdp11.c +++ b/bfd/pdp11.c @@ -2539,12 +2539,13 @@ NAME (aout, bfd_free_cached_info) (bfd *abfd) { asection *o; - if (bfd_get_format (abfd) != bfd_object) + if (bfd_get_format (abfd) != bfd_object + || abfd->tdata.aout_data == NULL) return true; #define BFCI_FREE(x) do { free (x); x = NULL; } while (0) + BFCI_FREE (adata (abfd).line_buf); BFCI_FREE (obj_aout_symbols (abfd)); - #ifdef USE_MMAP obj_aout_external_syms (abfd) = 0; bfd_free_window (&obj_aout_sym_window (abfd)); |