a memory leak when name lookup failed is now removed

This commit is contained in:
Daniel Stenberg 2002-01-14 23:14:24 +00:00
parent d220389647
commit fefc7ea600
1 changed files with 4 additions and 3 deletions

View File

@ -131,13 +131,14 @@ Curl_addrinfo *Curl_resolv(struct SessionHandle *data,
} }
/* Create a new cache entry */ /* Create a new cache entry */
p = (struct curl_dns_cache_entry *) malloc(sizeof(struct curl_dns_cache_entry)); p = (struct curl_dns_cache_entry *)
if (!p) { malloc(sizeof(struct curl_dns_cache_entry));
if (!p)
return NULL; return NULL;
}
p->addr = Curl_getaddrinfo(data, hostname, port, bufp); p->addr = Curl_getaddrinfo(data, hostname, port, bufp);
if (!p->addr) { if (!p->addr) {
free(p);
return NULL; return NULL;
} }
p->timestamp = now; p->timestamp = now;