about summary refs log tree commit diff
path: root/resolv/res_libc.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-12-22 20:10:10 +0000
committerUlrich Drepper <drepper@redhat.com>2004-12-22 20:10:10 +0000
commita334319f6530564d22e775935d9c91663623a1b4 (patch)
treeb5877475619e4c938e98757d518bb1e9cbead751 /resolv/res_libc.c
parent0ecb606cb6cf65de1d9fc8a919bceb4be476c602 (diff)
downloadglibc-a334319f6530564d22e775935d9c91663623a1b4.tar.gz
glibc-a334319f6530564d22e775935d9c91663623a1b4.tar.xz
glibc-a334319f6530564d22e775935d9c91663623a1b4.zip
(CFLAGS-tst-align.c): Add -mpreferred-stack-boundary=4.
Diffstat (limited to 'resolv/res_libc.c')
-rw-r--r--resolv/res_libc.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/resolv/res_libc.c b/resolv/res_libc.c
index 834773c32f..76abca8442 100644
--- a/resolv/res_libc.c
+++ b/resolv/res_libc.c
@@ -70,8 +70,14 @@ res_init(void) {
 		_res.retry = 4;
 	if (!(_res.options & RES_INIT))
 		_res.options = RES_DEFAULT;
-	else if (_res.nscount > 0)
-		__res_iclose (&_res, true);	/* Close any VC sockets.  */
+	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
@@ -97,7 +103,11 @@ __res_maybe_init (res_state resp, int preinit)
 	if (resp->options & RES_INIT) {
 		if (__res_initstamp != resp->_u._ext.initstamp) {
 			if (resp->nscount > 0) {
-				__res_iclose (resp, true);
+				__res_nclose (resp);
+				for (int ns = 0; ns < MAXNS; ns++) {
+					free (resp->_u._ext.nsaddrs[ns]);
+					resp->_u._ext.nsaddrs[ns] = NULL;
+				}
 				return __res_vinit (resp, 1);
 			}
 		}