From patchwork Wed Nov 18 15:30:02 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Schwab X-Patchwork-Id: 9722 Received: (qmail 19510 invoked by alias); 18 Nov 2015 15:30:07 -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 19460 invoked by uid 89); 18 Nov 2015 15:30:06 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.4 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx2.suse.de From: Andreas Schwab To: libc-alpha@sourceware.org Subject: [PATCH] Fix resource leak in resolver (bug 19257) X-Yow: I don't believe there really IS a GAS SHORTAGE.. I think it's all just a BIG HOAX on the part of the plastic sign salesmen-- .. to sell more numbers!! Date: Wed, 18 Nov 2015 16:30:02 +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 c5dc801..a14e981 100644 --- a/resolv/res_init.c +++ b/resolv/res_init.c @@ -593,7 +593,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]);