coff object_p memory leaks
authorAlan Modra <amodra@gmail.com>
Mon, 30 Dec 2019 10:47:08 +0000 (21:17 +1030)
committerAlan Modra <amodra@gmail.com>
Mon, 30 Dec 2019 13:20:35 +0000 (23:50 +1030)
* coffgen.c (coff_real_object_p): Free malloc'd memory on failure.

bfd/ChangeLog
bfd/coffgen.c

index 186346e9c159c5e165ab1871d71f43a3ba35fbc3..809f1ba56d47b7d367db7b1c1a4c66940466dcf5 100644 (file)
@@ -1,3 +1,7 @@
+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
index 57a18b02dc1dd10910a6a36db1d4a8ee63af0f8a..34d8d50506a51a7b6bd66b78ccc9bf144ecb9bfb 100644 (file)
@@ -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;