From 37d5ab199b072e3cf1e8bf2a9262767c4737d256 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Mon, 30 Dec 2019 21:17:08 +1030 Subject: [PATCH] coff object_p memory leaks * coffgen.c (coff_real_object_p): Free malloc'd memory on failure. --- bfd/ChangeLog | 4 ++++ bfd/coffgen.c | 3 +++ 2 files changed, 7 insertions(+) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 186346e9c15..809f1ba56d4 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,7 @@ +2019-12-30 Alan Modra + + * coffgen.c (coff_real_object_p): Free malloc'd memory on failure. + 2019-12-30 Alan Modra * archive.c (do_slurp_bsd_armap): Use bfd_alloc rather than diff --git a/bfd/coffgen.c b/bfd/coffgen.c index 57a18b02dc1..34d8d50506a 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; -- 2.30.2