From: Tom Tromey Date: Thu, 16 Aug 2012 14:24:44 +0000 (+0000) Subject: PR binutils/14475: X-Git-Tag: sid-snapshot-20120901~160 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a3074307fcc835389974b37ce6ecf1bb7ec4b52f;p=external%2Fbinutils.git PR binutils/14475: * archive.c (bfd_ar_hdr_from_filesystem): Allocate areltdata on 'member' BFD. Don't try to free 'ared'. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index deac174..2c3bacb 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2012-08-16 Tom Tromey + + PR binutils/14475: + * archive.c (bfd_ar_hdr_from_filesystem): Allocate areltdata on + 'member' BFD. Don't try to free 'ared'. + 2012-08-14 Nick Clifton * po/uk.po: Updated Ukranian translation. 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;