* aoutx.h (NAME(aout,canonicalize_reloc)): Don't error out if

section->relocation is NULL; malloc might have returned NULL when
	given a zero size if there were no relocations.
	* bout.c (b_out_canonicalize_reloc): Likewise.
	* coffcode.h (coff_canonicalize_reloc): Likewise.
	* ecoff.c (ecoff_canonicalize_reloc): Likewise.
	* elfcode.h (elf_canonicalize_reloc): Likewise.
	* mipsbsd.c (MY(canonicalize_reloc)): Likewise.
	* i386lynx.c (NAME(lynx,canonicalize_reloc)): Likewise.
	* nlmcode.h (nlm_canonicalize_reloc): Likewise.
	* som.c (som_canonicalize_reloc): Likewise.
	* hp300hpux.c (MY(slurp_reloc_table)): Likewise.  Also, if malloc
	returns NULL, don't report an error if we asked for zero bytes.
	* i386lynx.c (NAME(lynx,slurp_reloc_table)): If malloc returns
	NULL, don't report an error if we asked for zero bytes.
	* nlmcode.h (nlm_slurp_reloc_fixups): Likewise.
This commit is contained in:
Ian Lance Taylor
1994-04-05 15:32:49 +00:00
parent 4e8e5c4ac5
commit b3cee0a981
11 changed files with 26 additions and 26 deletions

View File

@@ -1050,7 +1050,7 @@ nlm_slurp_reloc_fixups (abfd)
count = nlm_fixed_header (abfd)->numberOfRelocationFixups;
rels = (arelent *) bfd_alloc (abfd, count * sizeof (arelent));
secs = (asection **) bfd_alloc (abfd, count * sizeof (asection *));
if (rels == NULL || secs == NULL)
if ((rels == NULL || secs == NULL) && count != 0)
{
bfd_set_error (bfd_error_no_memory);
return false;
@@ -1136,8 +1136,6 @@ nlm_canonicalize_reloc (abfd, sec, relptr, symbols)
if (nlm_slurp_reloc_fixups (abfd) == false)
return -1;
rels = nlm_relocation_fixups (abfd);
if (rels == NULL)
return -1;
}
secs = nlm_relocation_fixup_secs (abfd);