reverted. twas no memory leak and the "fix" didn't even compile on windows...
authorDaniel Stenberg <daniel@haxx.se>
Wed, 12 Sep 2001 08:59:00 +0000 (08:59 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 12 Sep 2001 08:59:00 +0000 (08:59 +0000)
lib/hostip.c

index be365d4..8526fb9 100644 (file)
@@ -125,8 +125,6 @@ struct hostent *Curl_gethost(struct SessionHandle *data,
 {
   struct hostent *h = NULL;
   unsigned long in;
-
-#ifdef HAVE_GETHOSTBYNAME_R
   int ret; /* this variable is unused on several platforms but used on some */
 
 #define CURL_NAMELOOKUP_SIZE 9000
@@ -138,7 +136,7 @@ struct hostent *Curl_gethost(struct SessionHandle *data,
   if(!buf)
     return NULL; /* major failure */
   *bufp = buf;
-#endif
+
   ret = 0; /* to prevent the compiler warning */
 
   if ( (in=inet_addr(hostname)) != INADDR_NONE ) {
@@ -208,9 +206,10 @@ struct hostent *Curl_gethost(struct SessionHandle *data,
     }
 #else
   else {
-    *bufp=NULL; /* zero this always */
     if ((h = gethostbyname(hostname)) == NULL ) {
       infof(data, "gethostbyname(2) failed for %s\n", hostname);
+      free(buf);
+      *bufp=NULL;
     }
 #endif
   }