diff options
author | Alan Modra <amodra@gmail.com> | 2019-05-22 17:52:59 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2019-05-22 18:33:39 +0930 |
commit | 4decd602d8570eda5d36fd6cca2e50091000fa7a (patch) | |
tree | de2bd28a6e1a0173a08914d85b7db83b9f2b019e /bfd/som.c | |
parent | 22c6ccb89e0f38a70a42fb49eb167e7857d51f5c (diff) | |
download | binutils-4decd602d8570eda5d36fd6cca2e50091000fa7a.zip binutils-4decd602d8570eda5d36fd6cca2e50091000fa7a.tar.gz binutils-4decd602d8570eda5d36fd6cca2e50091000fa7a.tar.bz2 |
bfdtest1 segfaults on hppa-hp-hpux10
The archive element cache needs tidying when closing an archive element.
This patch fixes these failures:
-FAIL: ar long file names (bfdtest1)
-FAIL: ar thin archive (bfdtest1)
-FAIL: ar thin archive with nested archive (bfdtest1)
* som.c (som_bfd_free_cached_info): Call
_bfd_generic_close_and_cleanup.
Diffstat (limited to 'bfd/som.c')
-rw-r--r-- | bfd/som.c | 30 |
1 files changed, 15 insertions, 15 deletions
@@ -6695,25 +6695,25 @@ som_write_armap (bfd *abfd, static bfd_boolean som_bfd_free_cached_info (bfd *abfd) { - asection *o; - - if (bfd_get_format (abfd) != bfd_object) - return TRUE; + if (bfd_get_format (abfd) == bfd_object) + { + asection *o; #define FREE(x) if (x != NULL) { free (x); x = NULL; } - /* Free the native string and symbol tables. */ - FREE (obj_som_symtab (abfd)); - FREE (obj_som_stringtab (abfd)); - for (o = abfd->sections; o != NULL; o = o->next) - { - /* Free the native relocations. */ - o->reloc_count = (unsigned) -1; - FREE (som_section_data (o)->reloc_stream); - /* Do not free the generic relocations as they are objalloc'ed. */ - } + /* Free the native string and symbol tables. */ + FREE (obj_som_symtab (abfd)); + FREE (obj_som_stringtab (abfd)); + for (o = abfd->sections; o != NULL; o = o->next) + { + /* Free the native relocations. */ + o->reloc_count = (unsigned) -1; + FREE (som_section_data (o)->reloc_stream); + /* Do not free the generic relocations as they are objalloc'ed. */ + } #undef FREE + } - return TRUE; + return _bfd_generic_close_and_cleanup (abfd); } /* End of miscellaneous support functions. */ |