aboutsummaryrefslogtreecommitdiff
path: root/bfd/coffgen.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2020-01-01 10:28:42 +1030
committerAlan Modra <amodra@gmail.com>2020-01-04 18:53:07 +1030
commit991fb595e34598291a52b533fdc8005e1ead0799 (patch)
tree32a27c687c953dcba3930d70e6e15a5c4c038a64 /bfd/coffgen.c
parent5ffd5873e653d4aa491d099e93833befffe86433 (diff)
downloadgdb-991fb595e34598291a52b533fdc8005e1ead0799.zip
gdb-991fb595e34598291a52b533fdc8005e1ead0799.tar.gz
gdb-991fb595e34598291a52b533fdc8005e1ead0799.tar.bz2
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.
Diffstat (limited to 'bfd/coffgen.c')
-rw-r--r--bfd/coffgen.c3
1 files changed, 3 insertions, 0 deletions
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: