This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
coff: free malloc'd memory on successful target match too
- From: Alan Modra <amodra at gmail dot com>
- To: binutils at sourceware dot org
- Date: Sat, 4 Jan 2020 19:20:42 +1030
- Subject: coff: free malloc'd memory on successful target match too
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.
diff --git a/bfd/coffgen.c b/bfd/coffgen.c
index 68b81ec588..2bfcf1a6b1 100644
--- a/bfd/coffgen.c
+++ b/bfd/coffgen.c
@@ -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:
--
Alan Modra
Australia Development Lab, IBM