mirror of https://github.com/getdnsapi/getdns.git
Fix misplaced freeaddrinfo
This commit is contained in:
parent
5d97f9d496
commit
011b504496
|
@ -314,7 +314,9 @@ str_addr_dict(getdns_context *context, const char *str)
|
||||||
|
|
||||||
if (getaddrinfo(str, NULL, &hints, &ai))
|
if (getaddrinfo(str, NULL, &hints, &ai))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
if (!ai)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
address = sockaddr_dict(context, ai->ai_addr);
|
address = sockaddr_dict(context, ai->ai_addr);
|
||||||
freeaddrinfo(ai);
|
freeaddrinfo(ai);
|
||||||
|
|
||||||
|
@ -692,9 +694,8 @@ set_os_defaults(struct getdns_context *context)
|
||||||
continue;
|
continue;
|
||||||
if ((s = getaddrinfo(parse, port_str, &hints, &result)))
|
if ((s = getaddrinfo(parse, port_str, &hints, &result)))
|
||||||
continue;
|
continue;
|
||||||
|
if (!result)
|
||||||
/* No lookups, so maximal 1 result */
|
continue;
|
||||||
if (! result) continue;
|
|
||||||
|
|
||||||
/* Grow array when needed */
|
/* Grow array when needed */
|
||||||
if (context->upstreams->count == upstreams_limit)
|
if (context->upstreams->count == upstreams_limit)
|
||||||
|
@ -705,8 +706,8 @@ set_os_defaults(struct getdns_context *context)
|
||||||
upstreams[context->upstreams->count++];
|
upstreams[context->upstreams->count++];
|
||||||
upstream_init(upstream, context->upstreams, result);
|
upstream_init(upstream, context->upstreams, result);
|
||||||
upstream->dns_base_transport = base_transport;
|
upstream->dns_base_transport = base_transport;
|
||||||
|
freeaddrinfo(result);
|
||||||
}
|
}
|
||||||
freeaddrinfo(result);
|
|
||||||
}
|
}
|
||||||
fclose(in);
|
fclose(in);
|
||||||
|
|
||||||
|
@ -1572,6 +1573,8 @@ getdns_context_set_upstream_recursive_servers(struct getdns_context *context,
|
||||||
|
|
||||||
if (getaddrinfo(addrstr, portstr, &hints, &ai))
|
if (getaddrinfo(addrstr, portstr, &hints, &ai))
|
||||||
goto invalid_parameter;
|
goto invalid_parameter;
|
||||||
|
if (!ai)
|
||||||
|
continue;
|
||||||
|
|
||||||
/* TODO[TLS]: Should probably check that the upstream doesn't
|
/* TODO[TLS]: Should probably check that the upstream doesn't
|
||||||
* already exist (in case user has specified TLS port explicitly and
|
* already exist (in case user has specified TLS port explicitly and
|
||||||
|
|
Loading…
Reference in New Issue