Commit fefc7ea6 authored by Daniel Stenberg's avatar Daniel Stenberg
Browse files

a memory leak when name lookup failed is now removed

parent d2203896
Loading
Loading
Loading
Loading
+4 −3
Original line number Original line Diff line number Diff line
@@ -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;