Bug 14481 - bfd leaks archive member hash table
Summary: bfd leaks archive member hash table
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: binutils (show other bugs)
Version: 2.24
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
: 14482 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-08-16 18:52 UTC by Tom Tromey
Modified: 2022-07-29 03:14 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments
test program (483 bytes, text/x-csrc)
2012-08-16 18:52 UTC, Tom Tromey
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Tromey 2012-08-16 18:52:01 UTC
Created attachment 6583 [details]
test program

BFD makes a hash table for archive members, but then leaks it.
See http://sourceware.org/ml/binutils/2012-07/msg00162.html
You can see the leak under valgrind using this program.
Be sure to run it on a normal archive, a thin archive, and
a thin archive that contains another archive.
Comment 1 H.J. Lu 2012-08-16 19:26:00 UTC
*** Bug 14482 has been marked as a duplicate of this bug. ***
Comment 2 Sourceware Commits 2012-08-16 20:31:40 UTC
CVSROOT:	/cvs/src
Module name:	src
Changes by:	hjl@sourceware.org	2012-08-16 20:31:35

Modified files:
	binutils       : ChangeLog Makefile.am Makefile.in 
	binutils/testsuite: ChangeLog 
	binutils/testsuite/binutils-all: ar.exp 
Added files:
	binutils       : bfdtest1.c 

Log message:
	Add a testcase for PR binutils/14481
	
	binutils/
	
	PR binutils/14481
	* Makefile.am (BFDTEST1_PROG): New.
	(TEST_PROGS): Likewise.
	(bfdtest1_DEPENDENCIES): Likewise.
	(noinst_PROGRAMS): Add $(TEST_PROGS).
	* Makefile.in: Regenerated.
	
	* bfdtest1.c: New file.
	
	binutils/testsuite/
	
	PR binutils/14481
	* ar.exp (bfdtest1): New.
	(long_filenames): Run bfdtest1.
	(thin_archive): Likewise.
	(thin_archive_with_nested): Likewise.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/binutils/bfdtest1.c.diff?cvsroot=src&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/binutils/ChangeLog.diff?cvsroot=src&r1=1.1932&r2=1.1933
http://sourceware.org/cgi-bin/cvsweb.cgi/src/binutils/Makefile.am.diff?cvsroot=src&r1=1.135&r2=1.136
http://sourceware.org/cgi-bin/cvsweb.cgi/src/binutils/Makefile.in.diff?cvsroot=src&r1=1.160&r2=1.161
http://sourceware.org/cgi-bin/cvsweb.cgi/src/binutils/testsuite/ChangeLog.diff?cvsroot=src&r1=1.265&r2=1.266
http://sourceware.org/cgi-bin/cvsweb.cgi/src/binutils/testsuite/binutils-all/ar.exp.diff?cvsroot=src&r1=1.16&r2=1.17
Comment 3 H.J. Lu 2012-08-16 20:33:47 UTC
I checked in a testcase.
Comment 4 H.J. Lu 2012-08-17 13:01:58 UTC
bfdtest1 test fail on targets which don't use archive
implementation in archive.c.  They include a.out
and VMS targets.
Comment 5 Sourceware Commits 2012-11-07 05:51:45 UTC
CVSROOT:	/cvs/src
Module name:	src
Changes by:	hp@sourceware.org	2012-11-07 05:51:37

Modified files:
	bfd            : ChangeLog aout-target.h 

Log message:
	PR binutils/14481
	* aout-target.h (MY_close_and_cleanup): Make local function
	instead of alias of MY_bfd_free_cached_info.  Also call
	_bfd_generic_close_and_cleanup.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/ChangeLog.diff?cvsroot=src&r1=1.5848&r2=1.5849
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/aout-target.h.diff?cvsroot=src&r1=1.43&r2=1.44
Comment 6 Hans-Peter Nilsson 2012-11-26 19:31:28 UTC
(In reply to comment #5)
> Changes by:    hp@sourceware.org    2012-11-07 05:51:37
> 
> Modified files:
>     bfd            : ChangeLog aout-target.h 

Please note that this was a fix only for *most* *a.out* targets.  To wit, it does not fix all targets and not all a.out targets.  See <http://sourceware.org/ml/binutils/2012-11/msg00078.html>.
Comment 7 Alan Modra 2022-07-29 03:14:23 UTC
I think this is mostly fixed, and what might not have been fixed is obsolete.