From patchwork Tue Feb 9 11:40:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Schwab X-Patchwork-Id: 10771 Received: (qmail 71746 invoked by alias); 9 Feb 2016 11:40:48 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 71558 invoked by uid 89); 9 Feb 2016 11:40:43 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx2.suse.de From: Andreas Schwab To: libc-alpha@sourceware.org Subject: [PATCH] Fix resource leak in resolver (bug 19257) X-Yow: Okay, BARBRA STREISAND, I recognize you now!! Also EFREM ZIMBALIST, JUNIOR!! And BEAUMONT NEWHALL!! Everybody into th' BATHROOM! Date: Tue, 09 Feb 2016 12:40:39 +0100 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 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]);