This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix resource leak in resolver (bug 19257)


On 03/14/2016 08:10 PM, Aurelien Jarno wrote:
> On 2016-02-09 12:40, Andreas Schwab wrote:
>> The number of currently defined nameservers is stored in ->nscount,
>> whereas ->_u._ext.nscount is set by __libc_res_nsend only after local
>> initializations.
>>
>> Andreas.
>>
>> 	* resolv/res_init.c (__res_iclose): Use statp->nscount instead of
>> 	statp->_u._ext.nscount as loop count.
>> ---
>>  resolv/res_init.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/resolv/res_init.c b/resolv/res_init.c
>> index e0b6a80..6c951f5 100644
>> --- a/resolv/res_init.c
>> +++ b/resolv/res_init.c
>> @@ -594,7 +594,7 @@ __res_iclose(res_state statp, bool free_addr) {
>>  		statp->_vcsock = -1;
>>  		statp->_flags &= ~(RES_F_VC | RES_F_CONN);
>>  	}
>> -	for (ns = 0; ns < statp->_u._ext.nscount; ns++)
>> +	for (ns = 0; ns < statp->nscount; ns++)
>>  		if (statp->_u._ext.nsaddrs[ns]) {
>>  			if (statp->_u._ext.nssocks[ns] != -1) {
>>  				close_not_cancel_no_status(statp->_u._ext.nssocks[ns]);
> 
> Thanks for the patch. I confirm this is the right thing to do, and I
> have tested that it works as expected.

Andreas, can you commit this, please?

I'll add a test for it later.

Florian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]