]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
elf: Call bfd_malloc instead xmalloc
authorH.J. Lu <hjl.tools@gmail.com>
Sat, 6 Apr 2024 00:10:24 +0000 (17:10 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Sat, 6 Apr 2024 12:07:33 +0000 (05:07 -0700)
* elflink.c (elf_link_add_object_symbols): Call bfd_malloc
instead of xmalloc.

bfd/elflink.c

index dadac2522d5839be0c65e2018199adb634641b08..c73470276cdd4a274ae4792ca5cb1114a6391e5f 100644 (file)
@@ -4378,12 +4378,13 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
        {
          /* Initialize first_hash for an IR input.  */
          htab->first_hash = (struct bfd_hash_table *)
-           xmalloc (sizeof (struct bfd_hash_table));
-         if (!bfd_hash_table_init
-             (htab->first_hash, elf_link_first_hash_newfunc,
-              sizeof (struct elf_link_first_hash_entry)))
+           bfd_malloc (sizeof (struct bfd_hash_table));
+         if (htab->first_hash == NULL
+             || !bfd_hash_table_init
+                  (htab->first_hash, elf_link_first_hash_newfunc,
+                   sizeof (struct elf_link_first_hash_entry)))
            info->callbacks->einfo
-             (_("%F%P: first_hash failed to initialize: %E\n"));
+             (_("%F%P: first_hash failed to create: %E\n"));
        }
     }
   else