diff options
author | Andreas Schwab <schwab@suse.de> | 2015-11-18 15:45:59 +0100 |
---|---|---|
committer | Aurelien Jarno <aurelien@aurel32.net> | 2016-03-20 12:23:51 +0100 |
commit | e5d560e0e7f621b5cde4bcbbac424f8b2742395a (patch) | |
tree | 9c32146ded3f5386dea372879de9ffb84338c33a | |
parent | 2b8ab5c3f618e4d9e0a9147c24f8cf6bbf35a1d8 (diff) | |
download | glibc-e5d560e0e7f621b5cde4bcbbac424f8b2742395a.tar.gz glibc-e5d560e0e7f621b5cde4bcbbac424f8b2742395a.tar.xz glibc-e5d560e0e7f621b5cde4bcbbac424f8b2742395a.zip |
Fix resource leak in resolver (bug 19257)
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)
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | resolv/res_init.c | 2 |
2 files changed, 7 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog index b224f46afb..ba4a3f2f65 100644 --- 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> diff --git a/resolv/res_init.c b/resolv/res_init.c index 66561ffac2..77873c1b94 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]); |