From: Michael Snyder Date: Fri, 27 Jul 2007 18:54:04 +0000 (+0000) Subject: 2007-07-27 Michael Snyder X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9d7038d33091834658c7ec239848931c7a856c91;p=binutils-gdb.git 2007-07-27 Michael Snyder * coffgen.c (_bfd_coff_read_internal_relocs): Return if count is zero. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index ef6e817cc2b..979d845367c 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,5 +1,7 @@ 2007-07-27 Michael Snyder + * 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 diff --git a/bfd/coffgen.c b/bfd/coffgen.c index 694625fa0a8..e5fb6454d34 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; }