bug-tar
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-tar] Memory leak in tar?


From: Ondřej Vašík
Subject: [Bug-tar] Memory leak in tar?
Date: Tue, 01 Sep 2009 14:49:12 +0200

Hello,
As reported in https://bugzilla.lustre.org/show_bug.cgi?id=20213 and 
later in https://bugzilla.redhat.com/show_bug.cgi?id=518079 , it seems
that tar has memory leak. Although it is reported against xattr support,
leak seems to be general (not Fedora/RHEL related) - present even with
upstream tar.

Reproducing is easy - just download
https://bugzilla.redhat.com/attachment.cgi?id=357964
file, and try to list/extract that file with tar under valgrind. 
Valgrind reports leak:
==14467== 1,111,237 bytes in 1,741 blocks are definitely lost in loss
record 3 of 3
==14467==    at 0x4005400: malloc (vg_replace_malloc.c:149)
==14467==    by 0x8076751: xmalloc (xmalloc.c:49)
==14467==    by 0x80579C3: xheader_read (xheader.c:650)
==14467==    by 0x805D8D3: read_header_primitive (list.c:389)
==14467==    by 0x805DB49: read_header (list.c:469)
==14467==    by 0x805DC77: read_and (list.c:80)
==14467==    by 0x8064FFB: main (tar.c:2504)

which seems to be caused by xheader.c:647 - just removing 'xheader_init
(xhdr)' line as proposed in
https://bugzilla.redhat.com/attachment.cgi?id=357843 solves the leak.

That xheader_init() was added as part of factorization commit
http://git.savannah.gnu.org/cgit/tar.git/commit/?id=64cddf2fbc246e331edcbc82e419785af7f819a5
 ,
but it is not clear why the initialization of obstack is done in
xheader_read function which uses only xhdr->buffer. Maybe done by
accident? It looks like it is safe to remove it, testsuite passes and
valgrind is silent... Or should be solved different way, Sergey?

Greetings,
         Ondřej Vašík

Attachment: signature.asc
Description: Toto je digitálně podepsaná část zprávy


reply via email to

[Prev in Thread] Current Thread [Next in Thread]