public inbox for binutils-cvs@sourceware.org
 help / color / mirror / Atom feed
From: H.J. Lu <hjl@sourceware.org>
To: binutils-cvs@sourceware.org
Subject: [binutils-gdb] elf: Call bfd_malloc instead xmalloc
Date: Sat,  6 Apr 2024 12:07:52 +0000 (GMT)	[thread overview]
Message-ID: <20240406120752.F3FAA3858D34@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=c411ee988375f8e7069c8ab408a7835a261d80d5

commit c411ee988375f8e7069c8ab408a7835a261d80d5
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Fri Apr 5 17:10:24 2024 -0700

    elf: Call bfd_malloc instead xmalloc
    
    * elflink.c (elf_link_add_object_symbols): Call bfd_malloc
            instead of xmalloc.

Diff:
---
 bfd/elflink.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/bfd/elflink.c b/bfd/elflink.c
index dadac2522d5..c73470276cd 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

                 reply	other threads:[~2024-04-06 12:07 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240406120752.F3FAA3858D34@sourceware.org \
    --to=hjl@sourceware.org \
    --cc=binutils-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).