From 991fb595e34598291a52b533fdc8005e1ead0799 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Wed, 1 Jan 2020 10:28: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. --- bfd/ChangeLog | 5 +++++ bfd/coffgen.c | 3 +++ 2 files changed, 8 insertions(+) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 0ad28a7..6d19839 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2020-01-04 Alan Modra + + * coffgen.c (coff_real_object_p): Free malloc'd memory on target + match too. + 2020-01-03 Nick Clifton PR 25307 diff --git a/bfd/coffgen.c b/bfd/coffgen.c index 68b81ec..2bfcf1a 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: -- cgit v1.1