memory leak in res_nsend()
Antony Dovgal
tony2001@phpclub.net
Mon Oct 24 18:04:00 GMT 2005
On 24.10.2005 21:57, Daniel Jacobowitz wrote:
> On Mon, Oct 24, 2005 at 09:45:42PM +0400, Antony Dovgal wrote:
>> On 24.10.2005 21:14, Daniel Jacobowitz wrote:
>> >On Mon, Oct 24, 2005 at 02:28:03PM +0400, Antony Dovgal wrote:
>> >>But res_nclose() doesn't free those segments.
>> >>That's what I've found in res_thread_freeres () function
>> >>(resolv/res_init.c):
>> >
>> >Well, when you're running under valgrind, the freeres functions are
>> >supposed to be called - for exactly this reason.
>>
>> Could you please elaborate: why should valgrind call something?
>> *I'm* calling res_nsend() and I suppose valgrind shouldn't call anything to
>> free resources allocated by the user function calls.
>> Am I wrong?
>
> Partly. valgrind frees things that would ordinarily be freed by
> exit(), so that it can detect leaks better.
>
> If it's doing that and still reporting a leak, then perhaps it should
> be calling __libc_thread_freeres in still-alive threads at exit.
__libc_thread_freeres(void) frees global _res, while I need to free resources associated with my local __res_state struct.
I honestly do not understand how can valgrind help me with that calling __libc_thread_freeres().
--
Wbr,
Antony Dovgal
More information about the Libc-alpha
mailing list