diff options
author | Tom Tromey <tromey@redhat.com> | 2012-08-16 14:24:44 +0000 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2012-08-16 14:24:44 +0000 |
commit | a3074307fcc835389974b37ce6ecf1bb7ec4b52f (patch) | |
tree | 3fb9b7c755aa4cfddefa1bbc2cbb8cb5955fe14b /bfd/archive.c | |
parent | 4232dbd15411526cd0fe55cfa668c2fecdf4b5dd (diff) | |
download | binutils-a3074307fcc835389974b37ce6ecf1bb7ec4b52f.zip binutils-a3074307fcc835389974b37ce6ecf1bb7ec4b52f.tar.gz binutils-a3074307fcc835389974b37ce6ecf1bb7ec4b52f.tar.bz2 |
PR binutils/14475:
* archive.c (bfd_ar_hdr_from_filesystem): Allocate areltdata on
'member' BFD. Don't try to free 'ared'.
Diffstat (limited to 'bfd/archive.c')
-rw-r--r-- | bfd/archive.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/bfd/archive.c b/bfd/archive.c index dc67da7..e0cb370 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 (abfd, amt); + ared = (struct areltdata *) bfd_zalloc (member, amt); if (ared == NULL) return NULL; hdr = (struct ar_hdr *) (((char *) ared) + sizeof (struct areltdata)); @@ -1927,10 +1927,7 @@ 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)) - { - free (ared); - return NULL; - } + return NULL; memcpy (hdr->ar_fmag, ARFMAG, 2); ared->parsed_size = status.st_size; ared->arch_header = (char *) hdr; |