X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=bfd%2Felf64-mips.c;h=a07c39f1fd13df86314540945c8998c7bd8a8e91;hb=9e7cb4c359e6a86550bca296db617fb4c8068c1a;hp=b674d52f7c68c3a203f1c6e1d6ffdf78e0b583bb;hpb=b3adc24a0713411ab38a21dc894dd40dbc5c8f4f;p=deliverable%2Fbinutils-gdb.git diff --git a/bfd/elf64-mips.c b/bfd/elf64-mips.c index b674d52f7c..a07c39f1fd 100644 --- a/bfd/elf64-mips.c +++ b/bfd/elf64-mips.c @@ -4010,15 +4010,12 @@ mips_elf64_slurp_one_reloc_table (bfd *abfd, asection *asect, int entsize; bfd_boolean rela_p; - allocated = bfd_malloc (rel_hdr->sh_size); + if (bfd_seek (abfd, rel_hdr->sh_offset, SEEK_SET) != 0) + return FALSE; + allocated = _bfd_malloc_and_read (abfd, rel_hdr->sh_size, rel_hdr->sh_size); if (allocated == NULL) return FALSE; - if (bfd_seek (abfd, rel_hdr->sh_offset, SEEK_SET) != 0 - || (bfd_bread (allocated, rel_hdr->sh_size, abfd) - != rel_hdr->sh_size)) - goto error_return; - native_relocs = allocated; entsize = rel_hdr->sh_entsize; @@ -4165,14 +4162,11 @@ mips_elf64_slurp_one_reloc_table (bfd *abfd, asection *asect, } } - if (allocated != NULL) - free (allocated); - + free (allocated); return TRUE; error_return: - if (allocated != NULL) - free (allocated); + free (allocated); return FALSE; }