summaryrefslogtreecommitdiff
path: root/bfd/coffgen.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2019-12-29 12:55:20 +1030
committerAlan Modra <amodra@gmail.com>2019-12-29 21:26:00 +1030
commitf5d35bb7a5789950efd5f03b270d4c5f774eaba9 (patch)
tree4e4b63370ff2c7c49a471587238d24a79b38cc83 /bfd/coffgen.c
parenta6e5765ff1c5fdebaf4953eed619a717178cc7e6 (diff)
coff_close_and_cleanup
Fixes leaks in _bfd_coff_get_external_symbols and _bfd_coff_read_string_table. * coffcode.h (coff_close_and_cleanup): Redefine to.. * coffgen.c (_bfd_coff_close_and_cleanup): ..this. New function. * libcoff-in.h (_bfd_coff_close_and_cleanup): Declare. * libcoff.h: Regenerate.
Diffstat (limited to 'bfd/coffgen.c')
-rw-r--r--bfd/coffgen.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/bfd/coffgen.c b/bfd/coffgen.c
index 7f26e18c45..57a18b02dc 100644
--- a/bfd/coffgen.c
+++ b/bfd/coffgen.c
@@ -3161,3 +3161,18 @@ bfd_coff_group_name (bfd *abfd, const asection *sec)
return ci->name;
return NULL;
}
+
+bfd_boolean
+_bfd_coff_close_and_cleanup (bfd *abfd)
+{
+ if (abfd->format == bfd_object
+ && bfd_family_coff (abfd)
+ && coff_data (abfd) != NULL)
+ {
+ obj_coff_keep_syms (abfd) = FALSE;
+ obj_coff_keep_strings (abfd) = FALSE;
+ if (!_bfd_coff_free_symbols (abfd))
+ return FALSE;
+ }
+ return _bfd_generic_close_and_cleanup (abfd);
+}