From c06f72661447a897d66ee18826044111df7f428e Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 21 Nov 2000 15:35:45 +0000 Subject: [PATCH] GetHost() now sets the third pointer to NULL when the lookup fails, as the memory is then freed in the function --- lib/hostip.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/hostip.c b/lib/hostip.c index 89ac57462..dc2ed0aec 100644 --- a/lib/hostip.c +++ b/lib/hostip.c @@ -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 }