coff: free malloc'd memory on successful target match too
authorAlan Modra <amodra@gmail.com>
Tue, 31 Dec 2019 23:58:42 +0000 (10:28 +1030)
committerAlan Modra <amodra@gmail.com>
Sat, 4 Jan 2020 08:23:07 +0000 (18:53 +1030)
object_p functions cannot allocate memory by malloc and not free it
before returning.  Even a successful target match may not be the best
match.  If a match isn't used then those malloc'd blocks won't be
freed.

* coffgen.c (coff_real_object_p): Free malloc'd memory on target
match too.

bfd/ChangeLog
bfd/coffgen.c

index 0ad28a798d0a5d3dfee54c169455128bf9bdc15a..6d19839fecc88561907cf455d6301f8993fd7665 100644 (file)
@@ -1,3 +1,8 @@
+2020-01-04  Alan Modra  <amodra@gmail.com>
+
+       * coffgen.c (coff_real_object_p): Free malloc'd memory on target
+       match too.
+
 2020-01-03  Nick Clifton  <nickc@redhat.com>
 
        PR 25307
index 68b81ec5886114f94bd7c1ad36c44e2dc2a9253a..2bfcf1a6b14a7ee6b3dd6c20905adc3adcb4b0fe 100644 (file)
@@ -302,6 +302,9 @@ coff_real_object_p (bfd *abfd,
        }
     }
 
+  obj_coff_keep_syms (abfd) = FALSE;
+  obj_coff_keep_strings (abfd) = FALSE;
+  _bfd_coff_free_symbols (abfd);
   return abfd->xvec;
 
  fail:
This page took 0.02642 seconds and 4 git commands to generate.