Subject: Re: Leaked handles on Windows

Re: Leaked handles on Windows

From: Vlad Dinulescu <vlad.dinulescu_at_avira.com>
Date: Wed, 13 May 2009 15:35:37 +0300

Couldn't we stop loading dynamically iphlpapi.dll in c-ares, at runtime
through LoadLibrary(), and just link c-ares against iphlpapi.dll?

Yang Tse wrote:
> 2009/5/13, Daniel Stenberg wrote:
>
>> (http://support.microsoft.com/default.aspx?scid=kb;en-us;836769)
>
> Quoting the above link...
>
>> This problem may occur when the following conditions are both true:
>>
>> Your program uses LoadLibrary calls and FreeLibrary calls to load
>> and to unload the Iphlpapi.dll file.
>>
>> A handle to the TCP/IP driver is not closed correctly when the
>> Iphlpapi.dll file is unloaded.
>
> I can make all sort of assumtions on what the second condition means,
> but I really don't know what it actually means.
>
> Since the get_iphlpapi_dns_info() function does not open nor close
> 'handles to the TCP/IP driver', whatever that means, in between the
> calls to LoadLibrary and FreeLibrary. Why on earth does
> GetNetworkParams() leak a handle?
>
> I fear the conditions mentioned above do not represent reality, and
> actually a different set of conditions are the ones that apply.
>
> Ugh!
>
Received on 2009-05-13