aboutsummaryrefslogtreecommitdiff
path: root/bfd/peicode.h
diff options
context:
space:
mode:
Diffstat (limited to 'bfd/peicode.h')
-rw-r--r--bfd/peicode.h13
1 files changed, 2 insertions, 11 deletions
diff --git a/bfd/peicode.h b/bfd/peicode.h
index 3f772a0..f569ccf 100644
--- a/bfd/peicode.h
+++ b/bfd/peicode.h
@@ -1273,16 +1273,10 @@ pe_ILF_object_p (bfd * abfd)
/* ptr += 2; */
/* Now read in the two strings that follow. */
- ptr = (bfd_byte *) bfd_alloc (abfd, size);
+ ptr = (bfd_byte *) _bfd_alloc_and_read (abfd, size, size);
if (ptr == NULL)
return NULL;
- if (bfd_bread (ptr, size, abfd) != size)
- {
- bfd_release (abfd, ptr);
- return NULL;
- }
-
symbol_name = (char *) ptr;
/* See PR 20905 for an example of where the strnlen is necessary. */
source_dll = symbol_name + strnlen (symbol_name, size - 1) + 1;
@@ -1494,12 +1488,9 @@ pe_bfd_object_p (bfd * abfd)
if (amt < sizeof (PEAOUTHDR))
amt = sizeof (PEAOUTHDR);
- opthdr = bfd_alloc (abfd, amt);
+ opthdr = _bfd_alloc_and_read (abfd, amt, opt_hdr_size);
if (opthdr == NULL)
return NULL;
- if (bfd_bread (opthdr, opt_hdr_size, abfd)
- != (bfd_size_type) opt_hdr_size)
- return NULL;
if (amt > opt_hdr_size)
memset (opthdr + opt_hdr_size, 0, amt - opt_hdr_size);