public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: Tom Tromey <tromey@redhat.com>
Cc: Binutils Development <binutils@sourceware.org>
Subject: Re: [PATCH 3/5] remove deleted BFDs from the archive cache
Date: Fri, 17 Aug 2012 17:11:00 -0000	[thread overview]
Message-ID: <CAMe9rOrQ1Vtixd__UeETcx7xbGij3nGLNwRjnD6qCD-k-k6dug@mail.gmail.com> (raw)
In-Reply-To: <871uj5laxs.fsf@fleche.redhat.com>

On Fri, Aug 17, 2012 at 9:50 AM, Tom Tromey <tromey@redhat.com> wrote:
>>>>>> "HJ" == H J Lu <hjl.tools@gmail.com> writes:
>
> HJ> I am not sure if we want to use bfd_zmalloc for all areltdata.  We
> HJ> use bfd_ar_hdr_from_filesystem since we can't use member
> HJ> objalloc nor archive objalloc.  In all other places, it is OK to
> HJ> use archive objalloc for areltdata.
>
> Aside from the latent bugs.
>
> HJ> Do you have a testcase to show there is a problem?
>
> barimba. valgrind --leak-check=full ./strip-new libutil.a
> [...]
> ==30145== 696 bytes in 6 blocks are definitely lost in loss record 21 of 21
> ==30145==    at 0x4A074CD: malloc (vg_replace_malloc.c:236)
> ==30145==    by 0x432A58: bfd_zmalloc (libbfd.c:319)
> ==30145==    by 0x428807: bfd_ar_hdr_from_filesystem (archive.c:1899)
> ==30145==    by 0x428E4D: _bfd_write_archive_contents (archive.c:2131)
> ==30145==    by 0x4342FE: bfd_close (opncls.c:714)
> ==30145==    by 0x407991: copy_archive (objcopy.c:2208)
> ==30145==    by 0x407E54: copy_file (objcopy.c:2318)
> ==30145==    by 0x404699: main (objcopy.c:3168)
>

From

http://sourceware.org/ml/binutils/2012-08/msg00309.html

diff --git a/bfd/archive.c b/bfd/archive.c
index 2d67e1f..af6ba24 100644
--- a/bfd/archive.c
+++ b/bfd/archive.c
@@ -2744,6 +2744,11 @@ _bfd_archive_close_and_cleanup (bfd *abfd)
 	      htab_clear_slot (htab, slot);
 	    }
 	}
+      else
+	{
+	  /* If HTAB is NULL, free ARED allocated with bfd_zmalloc.  */
+	  free (ared);
+	}
     }
   return TRUE;
 }

However, it assumes that archive member from filesystem is
closed after archive.  It won't be easy to get around it since
we can't get from archive member from filesystem to
archive.


-- 
H.J.

  reply	other threads:[~2012-08-17 16:59 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-03 14:55 Tom Tromey
2012-08-03 16:12 ` Alan Modra
2012-08-03 20:56   ` Tom Tromey
2012-08-08 22:47   ` Tom Tromey
2012-08-09 10:35     ` Alan Modra
2012-08-15 20:14       ` H.J. Lu
2012-08-15 21:30         ` Tom Tromey
2012-08-16 14:47           ` Alan Modra
2012-08-16 16:31             ` H.J. Lu
2012-08-16 18:14               ` Tom Tromey
2012-08-16 18:33                 ` H.J. Lu
2012-08-16 18:45                   ` Tom Tromey
2012-08-16 18:49                     ` H.J. Lu
2012-08-16 18:55                       ` Tom Tromey
2012-08-16 20:33                         ` Tom Tromey
2012-08-16 20:38                         ` H.J. Lu
2012-08-16 21:11                 ` H.J. Lu
2012-08-16 21:35                 ` H.J. Lu
2012-08-17  1:01                 ` Alan Modra
2012-08-17  1:06                   ` H.J. Lu
2012-08-17  2:44                     ` Alan Modra
2012-08-17  4:56                       ` Hans-Peter Nilsson
2012-08-17  5:04                         ` Alan Modra
2012-08-17  5:08                         ` H.J. Lu
2012-08-17  5:30                           ` H.J. Lu
2012-08-17  5:42                             ` H.J. Lu
2012-08-17  5:45                               ` H.J. Lu
2012-08-17  6:01                                 ` H.J. Lu
2012-08-17 13:10                                   ` H.J. Lu
2012-08-17 16:50                                     ` Hans-Peter Nilsson
2012-08-17 16:01                           ` Hans-Peter Nilsson
2012-08-17 16:10                             ` H.J. Lu
2012-08-17 16:14                               ` Hans-Peter Nilsson
2012-08-17 16:13                       ` Tom Tromey
2012-08-17 16:26                         ` H.J. Lu
2012-08-17 16:51                           ` Tom Tromey
2012-08-17 17:11                             ` H.J. Lu [this message]
2012-08-17 17:22                               ` Tom Tromey
2012-08-17 17:22                                 ` H.J. Lu
2012-08-17 19:03                                   ` Tom Tromey
2012-08-17 19:13                                     ` H.J. Lu
2012-08-18  4:37                         ` Alan Modra
2012-08-21  9:55                           ` Tom Tromey
2012-08-17  1:17                   ` Alan Modra
2012-08-17 15:36                   ` Tom Tromey
2012-08-17 15:38                     ` H.J. Lu
2012-08-17 15:43                       ` Tom Tromey
2012-08-17  0:48           ` H.J. Lu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAMe9rOrQ1Vtixd__UeETcx7xbGij3nGLNwRjnD6qCD-k-k6dug@mail.gmail.com \
    --to=hjl.tools@gmail.com \
    --cc=binutils@sourceware.org \
    --cc=tromey@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).