From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18406 invoked by alias); 26 Jul 2007 01:59:59 -0000 Received: (qmail 18398 invoked by uid 22791); 26 Jul 2007 01:59:58 -0000 X-Spam-Check-By: sourceware.org Received: from b.mail.sonic.net (HELO b.mail.sonic.net) (64.142.19.5) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 26 Jul 2007 01:59:56 +0000 Received: from webmail.sonic.net (b.webmail.sonic.net [64.142.100.148]) by b.mail.sonic.net (8.13.8.Beta0-Sonic/8.13.7) with ESMTP id l6Q1xsM7027366 for ; Wed, 25 Jul 2007 18:59:54 -0700 Received: from 12.7.175.2 (SquirrelMail authenticated user msnyder) by webmail.sonic.net with HTTP; Wed, 25 Jul 2007 18:59:54 -0700 (PDT) Message-ID: <6375.12.7.175.2.1185415194.squirrel@webmail.sonic.net> Date: Thu, 26 Jul 2007 02:03:00 -0000 Subject: [PATCH] linker.c, check for null return from bfd_hash_allocate From: msnyder@sonic.net To: binutils@sourceware.org User-Agent: SquirrelMail/1.4.9a MIME-Version: 1.0 Content-Type: multipart/mixed;boundary="----=_20070725185954_92957" Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org X-SW-Source: 2007-07/txt/msg00436.txt.bz2 ------=_20070725185954_92957 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit Content-length: 59 Most callers of bfd_hash_allocate check for null returns. ------=_20070725185954_92957 Content-Type: text/plain; name="linker.txt" Content-Transfer-Encoding: 8bit Content-Disposition: attachment; filename="linker.txt" Content-length: 1154 2007-07-25 Michael Snyder * 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; ------=_20070725185954_92957--