CURLcode Curl_doh_is_resolved(struct Curl_easy *data,
struct Curl_dns_entry **dnsp)
{
- CURLcode result;
+ CURLcode result = CURLE_OK;
struct doh_probes *dohp = data->state.async.doh;
+ struct dohentry de;
*dnsp = NULL; /* defaults to no response */
if(!dohp)
return CURLE_OUT_OF_MEMORY;
}
else if(!dohp->pending) {
DOHcode rc[DOH_SLOT_COUNT];
- struct dohentry de;
int slot;
/* Clear any result the might still be there */
struct Curl_dns_entry *dns;
struct Curl_addrinfo *ai;
-
if(Curl_trc_ft_is_verbose(data, &Curl_trc_feat_dns)) {
CURL_TRC_DNS(data, "hostname: %s", dohp->host);
doh_show(data, &de);
}
result = doh2ai(&de, dohp->host, dohp->port, &ai);
- if(result) {
- de_cleanup(&de);
- return result;
- }
+ if(result)
+ goto error;
/* we got a response, create a dns entry. */
dns = Curl_dnscache_mk_entry(data, ai, dohp->host, 0, dohp->port, FALSE);
de.https_rrs->len, &hrr);
if(result) {
infof(data, "Failed to decode HTTPS RR");
- return result;
+ Curl_resolv_unlink(data, &dns);
+ goto error;
}
infof(data, "Some HTTPS RR to process");
# ifdef DEBUGBUILD
/* All done */
data->state.async.done = TRUE;
- de_cleanup(&de);
- Curl_doh_cleanup(data);
- return result;
-
} /* !dohp->pending */
+ else
+ /* wait for pending DoH transactions to complete */
+ return CURLE_OK;
- /* else wait for pending DoH transactions to complete */
- return CURLE_OK;
+error:
+ de_cleanup(&de);
+ Curl_doh_cleanup(data);
+ return result;
}
void Curl_doh_close(struct Curl_easy *data)