diff options
Diffstat (limited to 'bfd/ecoff.c')
-rw-r--r-- | bfd/ecoff.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/bfd/ecoff.c b/bfd/ecoff.c index 15c18ac..1d9e385 100644 --- a/bfd/ecoff.c +++ b/bfd/ecoff.c @@ -1623,20 +1623,25 @@ ecoff_slurp_reloc_table (bfd *abfd, if (! _bfd_ecoff_slurp_symbol_table (abfd)) return FALSE; - amt = section->reloc_count; - amt *= sizeof (arelent); - internal_relocs = (arelent *) bfd_alloc (abfd, amt); - external_reloc_size = backend->external_reloc_size; amt = external_reloc_size * section->reloc_count; external_relocs = (char *) bfd_alloc (abfd, amt); - if (internal_relocs == NULL || external_relocs == NULL) + if (external_relocs == NULL) return FALSE; if (bfd_seek (abfd, section->rel_filepos, SEEK_SET) != 0) return FALSE; if (bfd_bread (external_relocs, amt, abfd) != amt) return FALSE; + amt = section->reloc_count; + amt *= sizeof (arelent); + internal_relocs = (arelent *) bfd_alloc (abfd, amt); + if (internal_relocs == NULL) + { + bfd_release (abfd, external_relocs); + return FALSE; + } + for (i = 0, rptr = internal_relocs; i < section->reloc_count; i++, rptr++) { struct internal_reloc intern; |