zz40-xc-ovr.m4: fix variable assignment of subshell output bashism
[platform/upstream/c-ares.git] / ares_free_hostent.c
index 623e1e2..7f44882 100644 (file)
@@ -1,4 +1,3 @@
-/* $Id$ */
 
 /* Copyright 1998 by the Massachusetts Institute of Technology.
  *
@@ -16,9 +15,8 @@
  */
 
 #include "ares_setup.h"
-#include <stdlib.h>
 
-#if !defined(WIN32) || defined(WATT32)
+#ifdef HAVE_NETDB_H
 #include <netdb.h>
 #endif
 
@@ -29,6 +27,9 @@ void ares_free_hostent(struct hostent *host)
 {
   char **p;
 
+  if (!host)
+    return;
+
   free((char *)(host->h_name));
   for (p = host->h_aliases; *p; p++)
     free(*p);