aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-m32c.c
diff options
context:
space:
mode:
Diffstat (limited to 'bfd/elf32-m32c.c')
-rw-r--r--bfd/elf32-m32c.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/bfd/elf32-m32c.c b/bfd/elf32-m32c.c
index a4dfd8d..a357f62 100644
--- a/bfd/elf32-m32c.c
+++ b/bfd/elf32-m32c.c
@@ -1499,11 +1499,10 @@ m32c_elf_relax_section
bfd_set_error (bfd_error_file_too_big);
goto error_return;
}
- shndx_buf = bfd_malloc (amt);
- if (shndx_buf == NULL)
+ if (bfd_seek (abfd, shndx_hdr->sh_offset, SEEK_SET) != 0)
goto error_return;
- if (bfd_seek (abfd, shndx_hdr->sh_offset, SEEK_SET) != 0
- || bfd_bread (shndx_buf, amt, abfd) != amt)
+ shndx_buf = _bfd_malloc_and_read (abfd, amt, amt);
+ if (shndx_buf == NULL)
goto error_return;
shndx_hdr->contents = shndx_buf;
}