aboutsummaryrefslogtreecommitdiff
path: root/resolv/res_libc.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-07-21 18:30:11 +0000
committerUlrich Drepper <drepper@redhat.com>2004-07-21 18:30:11 +0000
commit2ed2dc184687ed609f7223bb5e9b30712742e876 (patch)
tree02e751efa30036e368c34d32c4c81c670afbb3c2 /resolv/res_libc.c
parent84b5ba7ecf85e45792d1571c2b29a8f2dbf1c989 (diff)
downloadglibc-2ed2dc184687ed609f7223bb5e9b30712742e876.tar
glibc-2ed2dc184687ed609f7223bb5e9b30712742e876.tar.gz
glibc-2ed2dc184687ed609f7223bb5e9b30712742e876.tar.bz2
glibc-2ed2dc184687ed609f7223bb5e9b30712742e876.zip
Update.
2004-07-21 Jakub Jelinek <jakub@redhat.com> * resolv/res_libc.c (res_init): If RES_INIT is set and _res.nscount > 0, call __res_nclose and free nsaddrs. * resolv/Makefile: Add rules to build and run tst-leaks2. * resolv/tst-leaks2.c: New test.
Diffstat (limited to 'resolv/res_libc.c')
-rw-r--r--resolv/res_libc.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/resolv/res_libc.c b/resolv/res_libc.c
index 66da110d5f..94bb2fdca6 100644
--- a/resolv/res_libc.c
+++ b/resolv/res_libc.c
@@ -54,6 +54,14 @@ res_init(void) {
_res.retry = 4;
if (!(_res.options & RES_INIT))
_res.options = RES_DEFAULT;
+ else if (_res.nscount > 0) {
+ __res_nclose (&_res); /* Close any VC sockets. */
+
+ for (int ns = 0; ns < MAXNS; ns++) {
+ free (_res._u._ext.nsaddrs[ns]);
+ _res._u._ext.nsaddrs[ns] = NULL;
+ }
+ }
/*
* This one used to initialize implicitly to zero, so unless the app