aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorMichael Snyder <msnyder@vmware.com>2007-07-27 18:54:04 +0000
committerMichael Snyder <msnyder@vmware.com>2007-07-27 18:54:04 +0000
commit9d7038d33091834658c7ec239848931c7a856c91 (patch)
tree85368a27167dac0c2413f705c506534fe0a29e76 /bfd
parentc6aa130f78f1314bd01dba564a7ba6ec531d5601 (diff)
downloadgdb-9d7038d33091834658c7ec239848931c7a856c91.zip
gdb-9d7038d33091834658c7ec239848931c7a856c91.tar.gz
gdb-9d7038d33091834658c7ec239848931c7a856c91.tar.bz2
2007-07-27 Michael Snyder <msnyder@access-company.com>
* coffgen.c (_bfd_coff_read_internal_relocs): Return if count is zero.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog2
-rw-r--r--bfd/coffgen.c7
2 files changed, 7 insertions, 2 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index ef6e817..979d845 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,7 @@
2007-07-27 Michael Snyder <msnyder@access-company.com>
+ * coffgen.c (_bfd_coff_read_internal_relocs): Return if count is zero.
+
* elf32-i386.c (elf_i386_check_relocs): Check for null pointer.
2007-07-27 H.J. Lu <hongjiu.lu@intel.com>
diff --git a/bfd/coffgen.c b/bfd/coffgen.c
index 694625f..e5fb645 100644
--- a/bfd/coffgen.c
+++ b/bfd/coffgen.c
@@ -409,6 +409,9 @@ _bfd_coff_read_internal_relocs (bfd *abfd,
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)
{
@@ -425,7 +428,7 @@ _bfd_coff_read_internal_relocs (bfd *abfd,
if (external_relocs == NULL)
{
free_external = bfd_malloc (amt);
- if (free_external == NULL && sec->reloc_count > 0)
+ if (free_external == NULL)
goto error_return;
external_relocs = free_external;
}
@@ -439,7 +442,7 @@ _bfd_coff_read_internal_relocs (bfd *abfd,
amt = sec->reloc_count;
amt *= sizeof (struct internal_reloc);
free_internal = bfd_malloc (amt);
- if (free_internal == NULL && sec->reloc_count > 0)
+ if (free_internal == NULL)
goto error_return;
internal_relocs = free_internal;
}