From: msnyder@sonic.net
To: binutils@sourceware.org
Subject: [PATCH] linker.c, check for null return from bfd_hash_allocate
Date: Thu, 26 Jul 2007 02:03:00 -0000 [thread overview]
Message-ID: <6375.12.7.175.2.1185415194.squirrel@webmail.sonic.net> (raw)
[-- Attachment #1: Type: text/plain, Size: 59 bytes --]
Most callers of bfd_hash_allocate check for null returns.
[-- Attachment #2: linker.txt --]
[-- Type: text/plain, Size: 1154 bytes --]
2007-07-25 Michael Snyder <msnyder@access-company.com>
* linker.c (bfd_section_already_linked_table_insert): Check for
NULL return from bfd_hash_allocate.
(already_linked_newfunc): Ditto.
Index: linker.c
===================================================================
RCS file: /cvs/src/src/bfd/linker.c,v
retrieving revision 1.60
diff -p -r1.60 linker.c
*** linker.c 24 Jul 2007 23:38:13 -0000 1.60
--- linker.c 26 Jul 2007 01:55:13 -0000
*************** bfd_section_already_linked_table_insert
*** 2933,2938 ****
--- 2933,2940 ----
/* Allocate the memory from the same obstack as the hash table is
kept in. */
l = bfd_hash_allocate (&_bfd_section_already_linked_table, sizeof *l);
+ if (l == NULL)
+ return; /* Should we abort? */
l->sec = sec;
l->next = already_linked_list->entry;
already_linked_list->entry = l;
*************** already_linked_newfunc (struct bfd_hash_
*** 2946,2951 ****
--- 2948,2956 ----
struct bfd_section_already_linked_hash_entry *ret =
bfd_hash_allocate (table, sizeof *ret);
+ if (ret == NULL)
+ return ret;
+
ret->entry = NULL;
return &ret->root;
next reply other threads:[~2007-07-26 1:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-26 2:03 msnyder [this message]
2007-07-26 14:22 ` Alan Modra
2007-07-26 23:24 ` msnyder
2007-07-26 23:57 ` Alan Modra
2007-07-27 1:16 ` msnyder
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=6375.12.7.175.2.1185415194.squirrel@webmail.sonic.net \
--to=msnyder@sonic.net \
--cc=binutils@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).