- buf = malloc (entry->physical_size);
- if (buf == NULL)
- {
- fprintf (f, "[ERROR]\n");
- return;
- }
- if (bfd_seek (abfd, entry->offset, SEEK_SET) < 0)
- {
- fprintf (f, "[ERROR]\n");
- free (buf);
- return;
- }
- if (bfd_bread (buf, entry->physical_size, abfd) != entry->physical_size)
+ if (bfd_seek (abfd, entry->offset, SEEK_SET) != 0
+ || (buf = _bfd_malloc_and_read (abfd, entry->physical_size,
+ entry->physical_size)) == NULL)