aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2002-01-14 23:14:24 +0000
committerDaniel Stenberg <daniel@haxx.se>2002-01-14 23:14:24 +0000
commitfefc7ea6008c48cbc3c346da4da55169da8c3adc (patch)
tree5b2ace6bd392390bc6a28606fee97a945f0b9519
parentd2203896476b61af0c2cb0f49b96c0a636fa9e42 (diff)
a memory leak when name lookup failed is now removed
-rw-r--r--lib/hostip.c7
1 files changed, 4 insertions, 3 deletions
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;