Correctly handle allocation failures in evdns_getaddrinfo

Kuldeep Gupta appears to have used some kind of automated tool to
find this and generate a patch for half the issue as #149.
This commit is contained in:
Nick Mathewson 2014-08-29 15:26:56 -04:00
parent 9d6acdc551
commit 6a53d15383

View File

@ -4668,7 +4668,7 @@ evdns_getaddrinfo(struct evdns_base *dns_base,
data->ipv4_request.r = evdns_base_resolve_ipv4(dns_base,
nodename, 0, evdns_getaddrinfo_gotresolve,
&data->ipv4_request);
if (want_cname)
if (want_cname && data->ipv4_request.r))
data->ipv4_request.r->current_req->put_cname_in_ptr =
&data->cname_result;
}
@ -4679,7 +4679,7 @@ evdns_getaddrinfo(struct evdns_base *dns_base,
data->ipv6_request.r = evdns_base_resolve_ipv6(dns_base,
nodename, 0, evdns_getaddrinfo_gotresolve,
&data->ipv6_request);
if (want_cname)
if (want_cname && data->ipv6_request.r)
data->ipv6_request.r->current_req->put_cname_in_ptr =
&data->cname_result;
}