coff object_p memory leaks

Message ID 20191230132137.GK16749@bubble.grove.modra.org
State New
Headers show
Series
  • coff object_p memory leaks
Related show

Commit Message

Alan Modra Dec. 30, 2019, 1:21 p.m.
* coffgen.c (coff_real_object_p): Free malloc'd memory on failure.


-- 
Alan Modra
Australia Development Lab, IBM

Patch

diff --git a/bfd/coffgen.c b/bfd/coffgen.c
index 57a18b02dc..34d8d50506 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;