[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-wget] Memory leak in idn_encode; Valgrind suppression file
From: |
Hubert Tarasiuk |
Subject: |
[Bug-wget] Memory leak in idn_encode; Valgrind suppression file |
Date: |
Mon, 06 Apr 2015 12:57:18 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 |
Hello devs,
I have spotted and repaired a memory leak in iri.c (idn_encode).
The problem was, that `remote_to_utf8` would allocate a new buffer, but
the buffer was never freed.
(It was the `new` pointer, later copied to `host`, used for
`idna_to_ascii_8z`. After returning from idn_encode, it was out of scope.)
To avoid similar problems in the future, I have also given more
meaningful names to the pointers, and added a new pointer to get rid of
the confusing variable reusage.
Please review the patch, and if you agree, please apply.
Also, IMHO it is worth to add a suppression file for valgrind tests in
wget. Otherwise, the tests do not pass. (Apart from the bug mentioned
above, there is a Valgrind's false positive at `idna_to_ascii_4z` in
`libidn.so`.) And since the first part (`tests`) fails, `make check`
does not even make it to the second part (`testenv`). (Which is probably
another bug, not a feature :D.)
The problem is, that I do not see a simple way to add it in one place;
as Valgrind invocation is handled separately in both `testenv` and
`tests`. However, the problem appears only in `tests` currently,
therefore maybe it could be added just there.
I am attaching my workaround for the problem (Valgrind's suppression
file and a patch to WgetTests.pm) - it could be probably done in a more
elegant way.
Regards,
Hubert
0001-Remove-memory-leak-in-idn_encode.patch
Description: Text Data
0002-Add-Valgrind-suppresion-for-libidn.so-at-idna_to_asc.patch
Description: Text Data
signature.asc
Description: OpenPGP digital signature
- [Bug-wget] Memory leak in idn_encode; Valgrind suppression file,
Hubert Tarasiuk <=
- Re: [Bug-wget] Memory leak in idn_encode; Valgrind suppression file, Ander Juaristi, 2015/04/06
- Re: [Bug-wget] Memory leak in idn_encode; Valgrind suppression file, Ángel González, 2015/04/06
- Re: [Bug-wget] Memory leak in idn_encode; Valgrind suppression file, Hubert Tarasiuk, 2015/04/06
- Re: [Bug-wget] Memory leak in idn_encode; Valgrind suppression file, Ángel González, 2015/04/06
- Re: [Bug-wget] Memory leak in idn_encode; Valgrind suppression file, Hubert Tarasiuk, 2015/04/08
- Re: [Bug-wget] Memory leak in idn_encode; Valgrind suppression file, Ángel González, 2015/04/08
- Re: [Bug-wget] Memory leak in idn_encode; Valgrind suppression file, Tim Rühsen, 2015/04/10
- Re: [Bug-wget] Memory leak in idn_encode; Valgrind suppression file, Hubert Tarasiuk, 2015/04/11