aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2019-12-30 21:17:08 +1030
committerAlan Modra <amodra@gmail.com>2019-12-30 23:50:35 +1030
commit37d5ab199b072e3cf1e8bf2a9262767c4737d256 (patch)
treec50f9140126060f44d1c7f282f6e8e6d9020b96f /bfd
parent6a89db5c9513d5e00e02b01095bf0c18e496dcc8 (diff)
downloadgdb-37d5ab199b072e3cf1e8bf2a9262767c4737d256.zip
gdb-37d5ab199b072e3cf1e8bf2a9262767c4737d256.tar.gz
gdb-37d5ab199b072e3cf1e8bf2a9262767c4737d256.tar.bz2
coff object_p memory leaks
* coffgen.c (coff_real_object_p): Free malloc'd memory on failure.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog4
-rw-r--r--bfd/coffgen.c3
2 files changed, 7 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 186346e..809f1ba 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,9 @@
2019-12-30 Alan Modra <amodra@gmail.com>
+ * coffgen.c (coff_real_object_p): Free malloc'd memory on failure.
+
+2019-12-30 Alan Modra <amodra@gmail.com>
+
* archive.c (do_slurp_bsd_armap): Use bfd_alloc rather than
bfd_zalloc when memory is all written after the call.
(do_slurp_coff_armap): Likewise. Set bfd_error on ridiculously
diff --git a/bfd/coffgen.c b/bfd/coffgen.c
index 57a18b0..34d8d50 100644
--- a/bfd/coffgen.c
+++ b/bfd/coffgen.c
@@ -305,6 +305,9 @@ coff_real_object_p (bfd *abfd,
return abfd->xvec;
fail:
+ obj_coff_keep_syms (abfd) = FALSE;
+ obj_coff_keep_strings (abfd) = FALSE;
+ _bfd_coff_free_symbols (abfd);
bfd_release (abfd, tdata);
fail2:
abfd->tdata.any = tdata_save;