aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2024-04-05 17:10:24 -0700
committerH.J. Lu <hjl.tools@gmail.com>2024-04-06 05:07:33 -0700
commitc411ee988375f8e7069c8ab408a7835a261d80d5 (patch)
tree332f871bc3b09752c56fd8105f0d77efd0e0eead
parentcca46dea4d09fc9d9896e952242b3e8f5baa506a (diff)
downloadgdb-c411ee988375f8e7069c8ab408a7835a261d80d5.zip
gdb-c411ee988375f8e7069c8ab408a7835a261d80d5.tar.gz
gdb-c411ee988375f8e7069c8ab408a7835a261d80d5.tar.bz2
elf: Call bfd_malloc instead xmalloc
* elflink.c (elf_link_add_object_symbols): Call bfd_malloc instead of xmalloc.
-rw-r--r--bfd/elflink.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/bfd/elflink.c b/bfd/elflink.c
index dadac25..c734702 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -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