aboutsummaryrefslogtreecommitdiff
path: root/bfd/archive.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2012-08-17 01:06:27 +0000
committerAlan Modra <amodra@gmail.com>2012-08-17 01:06:27 +0000
commited668b34df4ca6f8e8fbd4d5503e6b8e845833c2 (patch)
tree1a2c23ee5387469fc6ec7cdc2052e7ab583634af /bfd/archive.c
parentf75182c8228ac39e66f3e84630ab3b756b135b74 (diff)
downloadgdb-ed668b34df4ca6f8e8fbd4d5503e6b8e845833c2.zip
gdb-ed668b34df4ca6f8e8fbd4d5503e6b8e845833c2.tar.gz
gdb-ed668b34df4ca6f8e8fbd4d5503e6b8e845833c2.tar.bz2
PR binutils/14475:
* archive.c (bfd_ar_hdr_from_filesystem): Revert last change. Instead malloc areltdata.
Diffstat (limited to 'bfd/archive.c')
-rw-r--r--bfd/archive.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/bfd/archive.c b/bfd/archive.c
index e0cb370..2d67e1f 100644
--- a/bfd/archive.c
+++ b/bfd/archive.c
@@ -1896,7 +1896,7 @@ bfd_ar_hdr_from_filesystem (bfd *abfd, const char *filename, bfd *member)
}
amt = sizeof (struct ar_hdr) + sizeof (struct areltdata);
- ared = (struct areltdata *) bfd_zalloc (member, amt);
+ ared = (struct areltdata *) bfd_zmalloc (amt);
if (ared == NULL)
return NULL;
hdr = (struct ar_hdr *) (((char *) ared) + sizeof (struct areltdata));
@@ -1927,7 +1927,10 @@ bfd_ar_hdr_from_filesystem (bfd *abfd, const char *filename, bfd *member)
_bfd_ar_spacepad (hdr->ar_mode, sizeof (hdr->ar_mode), "%-8lo",
status.st_mode);
if (!_bfd_ar_sizepad (hdr->ar_size, sizeof (hdr->ar_size), status.st_size))
- return NULL;
+ {
+ free (ared);
+ return NULL;
+ }
memcpy (hdr->ar_fmag, ARFMAG, 2);
ared->parsed_size = status.st_size;
ared->arch_header = (char *) hdr;