summaryrefslogtreecommitdiff
path: root/bfd/elf.c
diff options
context:
space:
mode:
Diffstat (limited to 'bfd/elf.c')
-rw-r--r--bfd/elf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/bfd/elf.c b/bfd/elf.c
index 30e1efe6bb6..04eff22e15a 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -7207,7 +7207,7 @@ _bfd_elf_close_and_cleanup (bfd *abfd)
{
if (bfd_get_format (abfd) == bfd_object)
{
- if (elf_shstrtab (abfd) != NULL)
+ if (elf_tdata (abfd) != NULL && elf_shstrtab (abfd) != NULL)
_bfd_elf_strtab_free (elf_shstrtab (abfd));
_bfd_dwarf2_cleanup_debug_info (abfd);
}