From: Daniel Stenberg Date: Mon, 14 Jan 2002 23:14:24 +0000 (+0000) Subject: a memory leak when name lookup failed is now removed X-Git-Tag: curl-7_9_3-pre2~14 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fefc7ea6008c48cbc3c346da4da55169da8c3adc;p=curl a memory leak when name lookup failed is now removed --- diff --git a/lib/hostip.c b/lib/hostip.c index 829188c49..1f3b850e2 100644 --- a/lib/hostip.c +++ b/lib/hostip.c @@ -131,13 +131,14 @@ Curl_addrinfo *Curl_resolv(struct SessionHandle *data, } /* Create a new cache entry */ - p = (struct curl_dns_cache_entry *) malloc(sizeof(struct curl_dns_cache_entry)); - if (!p) { + p = (struct curl_dns_cache_entry *) + malloc(sizeof(struct curl_dns_cache_entry)); + if (!p) return NULL; - } p->addr = Curl_getaddrinfo(data, hostname, port, bufp); if (!p->addr) { + free(p); return NULL; } p->timestamp = now;