bfdtest1 segfaults on hppa-hp-hpux10
authorAlan Modra <amodra@gmail.com>
Wed, 22 May 2019 08:22:59 +0000 (17:52 +0930)
committerAlan Modra <amodra@gmail.com>
Wed, 22 May 2019 09:03:39 +0000 (18:33 +0930)
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.

bfd/ChangeLog
bfd/som.c

index 320e06ac7e9dad5c50e367a5733e250d51d76483..af7ae755ea11d4b43a0b14aaeb9bf3312f9bd7b9 100644 (file)
@@ -1,3 +1,8 @@
+2019-05-22  Alan Modra  <amodra@gmail.com>
+
+       * som.c (som_bfd_free_cached_info): Call
+       _bfd_generic_close_and_cleanup.
+
 2019-05-21  Faraz Shahbazker  <fshahbazker@wavecomp.com>
 
        * elfxx-mips.c (_bfd_mips_elf_check_relocs): Generate error
index 640253ea9af8874e638faed5924424dc26cd0894..0d17b3278a4db5479829a410742c0bc1b823bcc0 100644 (file)
--- a/bfd/som.c
+++ b/bfd/som.c
@@ -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.  */
This page took 0.030125 seconds and 4 git commands to generate.