]> granicus.if.org Git - curl/commitdiff
GetHost() now sets the third pointer to NULL when the lookup fails, as the
authorDaniel Stenberg <daniel@haxx.se>
Tue, 21 Nov 2000 15:35:45 +0000 (15:35 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 21 Nov 2000 15:35:45 +0000 (15:35 +0000)
memory is then freed in the function

lib/hostip.c

index 89ac57462e8b44a7c3dfe61dad28430e7ff9da3e..dc2ed0aecdd6334be2bad010e3f447e07ee59023 100644 (file)
@@ -187,12 +187,14 @@ struct hostent *GetHost(struct UrlData *data,
       infof(data, "gethostbyname_r(2) failed for %s\n", hostname);
       h = NULL; /* set return code to NULL */
       free(buf);
+      *bufp=NULL;
     }
 #else
   else {
     if ((h = gethostbyname(hostname)) == NULL ) {
       infof(data, "gethostbyname(2) failed for %s\n", hostname);
       free(buf);
+      *bufp=NULL;
     }
 #endif
   }