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>
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)
{
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;
}
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;
}