aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf.c
diff options
context:
space:
mode:
Diffstat (limited to 'bfd/elf.c')
-rw-r--r--bfd/elf.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/bfd/elf.c b/bfd/elf.c
index fa83495..71d13f7 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -4236,7 +4236,11 @@ boolean
_bfd_elf_close_and_cleanup (abfd)
bfd *abfd;
{
- if (elf_shstrtab (abfd))
- _bfd_stringtab_free (elf_shstrtab (abfd));
+ if (bfd_get_format (abfd) == bfd_object)
+ {
+ if (elf_shstrtab (abfd) != NULL)
+ _bfd_stringtab_free (elf_shstrtab (abfd));
+ }
+
return _bfd_generic_close_and_cleanup (abfd);
}