summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--resolv/res_init.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/resolv/res_init.c b/resolv/res_init.c
index 459694fbd4..7b9cf43313 100644
--- a/resolv/res_init.c
+++ b/resolv/res_init.c
@@ -567,6 +567,10 @@ libc_hidden_def (__res_nclose)
 static void __attribute__ ((section ("__libc_thread_freeres_fn")))
 res_thread_freeres (void)
 {
+  if (_res.nscount == 0)
+    /* Never called res_ninit.  */
+    return;
+
   __res_nclose (&_res);		/* Close any VC sockets.  */
 
   for (int ns = 0; ns < MAXNS; ns++)