]> 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)
committerAurelien Jarno <aurelien@aurel32.net>
Sun, 20 Mar 2016 11:23:51 +0000 (12:23 +0100)
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)

ChangeLog
resolv/res_init.c

index b224f46afb48f751dc555cbaa4b0ff50f3cfc280..ba4a3f2f65e8e5d35fb1299aaa246e9d211c10d7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2016-03-15  Andreas Schwab  <schwab@suse.de>
+
+       [BZ #19257]
+       * resolv/res_init.c (__res_iclose): Use statp->nscount instead of
+       statp->_u._ext.nscount as loop count.
+
 2016-02-17  Andrew Senkevich  <andrew.senkevich@intel.com>
            H.J. Lu  <hongjiu.lu@intel.com>
 
index 66561ffac2ffc039707676ed8b4bf36ee50ee889..77873c1b94a3bc60f5ba80a3ceb9e93d4f3d0d3a 100644 (file)
@@ -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]);