]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
BFD: Remove null pointer checks for `bfd_hash_table_free' calls
authorMaciej W. Rozycki <macro@redhat.com>
Tue, 20 Jan 2026 15:29:15 +0000 (15:29 +0000)
committerMaciej W. Rozycki <macro@redhat.com>
Tue, 20 Jan 2026 15:29:15 +0000 (15:29 +0000)
Given that as from commit 90e5645309be ("libiberty: Make `objalloc_free'
`free'-like WRT null pointer") `bfd_hash_table_free' now returns with no
action taken when called for a hash table with no allocation present,
remove null pointer checks guarding invocations.

bfd/opncls.c
binutils/wrstabs.c

index 2ef820ffdb7170c744150ce35d1bef479edc49cc..624c958febfadfd0a5bcef0486d47b692ea365ad 100644 (file)
@@ -151,8 +151,7 @@ _bfd_delete_bfd (bfd *abfd)
     bfd_free_cached_info (abfd);
 
   /* The target _bfd_free_cached_info may not have done anything..  */
-  if (abfd->section_htab.memory)
-    bfd_hash_table_free (&abfd->section_htab);
+  bfd_hash_table_free (&abfd->section_htab);
   if (abfd->memory)
     objalloc_free (abfd->memory);
 
@@ -186,8 +185,7 @@ DESCRIPTION
 bool
 _bfd_free_cached_info (bfd *abfd)
 {
-  if (abfd->section_htab.memory)
-    bfd_hash_table_free (&abfd->section_htab);
+  bfd_hash_table_free (&abfd->section_htab);
 
   abfd->sections = NULL;
   abfd->section_last = NULL;
index dad2ca8b690c3c2fab96afc6313095652141f5f6..8e17ff7a12f4e76553f1d9552e1e2baa44629743 100644 (file)
@@ -555,10 +555,8 @@ write_stabs_in_sections_debugging_info (bfd *abfd, void *dhandle,
   free (info.type_cache.function_types);
   free (info.type_cache.reference_types);
   free (info.type_cache.struct_types);
-  if (info.typedef_hash.table.memory)
-    bfd_hash_table_free (&info.typedef_hash.table);
-  if (info.strhash.table.memory)
-    bfd_hash_table_free (&info.strhash.table);
+  bfd_hash_table_free (&info.typedef_hash.table);
+  bfd_hash_table_free (&info.strhash.table);
   return ret;
 }