diff --git a/lib/hostip.c b/lib/hostip.c index 2fd99ef9f..95029e6b2 100644 --- a/lib/hostip.c +++ b/lib/hostip.c @@ -928,8 +928,10 @@ Curl_addrinfo *Curl_he2ai(const struct hostent *he, int port) prevai = ai; } - if(result != CURLE_OK) + if(result != CURLE_OK) { Curl_freeaddrinfo(firstai); + firstai = NULL; + } return firstai; }