]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Fix resource leak in resolver (bug 19257)
authorAndreas Schwab <schwab@suse.de>
Wed, 18 Nov 2015 14:45:59 +0000 (15:45 +0100)
committerMike Frysinger <vapier@gentoo.org>
Wed, 30 Mar 2016 21:15:13 +0000 (17:15 -0400)
The number of currently defined nameservers is stored in ->nscount,
whereas ->_u._ext.nscount is set by __libc_res_nsend only after local
initializations.

(cherry picked from commit 5e7fdabd7df1fc6c56d104e61390bf5a6b526c38)
(cherry picked from commit 317da342ba4417c30d985f5593d78bb1364a62c3)

resolv/res_init.c

index e0b6a80dc7656c6a7565fd39d18aed74599a108c..6c951f526eff36eea4e449422845f3c5804a03ee 100644 (file)
@@ -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]);