public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: msnyder@sonic.net
To: binutils@sourceware.org
Subject: [PATCH] coff_read_internal_relocs, count == 0
Date: Fri, 27 Jul 2007 02:07:00 -0000	[thread overview]
Message-ID: <7526.12.7.175.2.1185501466.squirrel@webmail.sonic.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 0 bytes --]



[-- Attachment #2: coffgen6.txt --]
[-- Type: text/plain, Size: 1801 bytes --]

2007-07-26  Michael Snyder  <msnyder@access-company.com>

	* coffgen.c (_bfd_coff_read_internal_relocs): If count is zero return.

Index: coffgen.c
===================================================================
RCS file: /cvs/src/src/bfd/coffgen.c,v
retrieving revision 1.62
diff -p -r1.62 coffgen.c
*** coffgen.c	26 Jul 2007 19:06:12 -0000	1.62
--- coffgen.c	27 Jul 2007 01:56:36 -0000
*************** _bfd_coff_read_internal_relocs (bfd *abf
*** 409,414 ****
--- 409,417 ----
    struct internal_reloc *irel;
    bfd_size_type amt;
  
+   if (sec->reloc_count == 0)
+     return internal_relocs;	/* Nothing to do.  */
+ 
    if (coff_section_data (abfd, sec) != NULL
        && coff_section_data (abfd, sec)->relocs != NULL)
      {
*************** _bfd_coff_read_internal_relocs (bfd *abf
*** 425,431 ****
    if (external_relocs == NULL)
      {
        free_external = bfd_malloc (amt);
!       if (free_external == NULL && sec->reloc_count > 0)
  	goto error_return;
        external_relocs = free_external;
      }
--- 428,434 ----
    if (external_relocs == NULL)
      {
        free_external = bfd_malloc (amt);
!       if (free_external == NULL)
  	goto error_return;
        external_relocs = free_external;
      }
*************** _bfd_coff_read_internal_relocs (bfd *abf
*** 439,445 ****
        amt = sec->reloc_count;
        amt *= sizeof (struct internal_reloc);
        free_internal = bfd_malloc (amt);
!       if (free_internal == NULL && sec->reloc_count > 0)
  	goto error_return;
        internal_relocs = free_internal;
      }
--- 442,448 ----
        amt = sec->reloc_count;
        amt *= sizeof (struct internal_reloc);
        free_internal = bfd_malloc (amt);
!       if (free_internal == NULL)
  	goto error_return;
        internal_relocs = free_internal;
      }

             reply	other threads:[~2007-07-27  1:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-27  2:07 msnyder [this message]
2007-07-27  4:51 ` Alan Modra
2007-07-27 19:05   ` 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=7526.12.7.175.2.1185501466.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).