mirror of
https://github.com/curl/curl.git
synced 2026-04-14 22:21:41 +03:00
hostip.c: fix leak of addrinfo
When creating a dns entry, the addrinfo is passed into the entry on success and needed deallocation by the caller on failure. Change the signature to have Curl_dnscache_mk_entry() *always* take ownership of the addrinfo, even on failure. Change parameter to address of pointer so that call always clears it. This makes the handling of failures to Curl_dnscache_mk_entry() simpler. Fixes #20465 Closes #20468
This commit is contained in:
parent
a84b041281
commit
ffdbc04c7b
5 changed files with 24 additions and 27 deletions
|
|
@ -1253,7 +1253,8 @@ CURLcode Curl_doh_is_resolved(struct Curl_easy *data,
|
|||
goto error;
|
||||
|
||||
/* we got a response, create a dns entry. */
|
||||
dns = Curl_dnscache_mk_entry(data, ai, dohp->host, 0, dohp->port, FALSE);
|
||||
dns = Curl_dnscache_mk_entry(data, &ai, dohp->host, 0,
|
||||
dohp->port, FALSE);
|
||||
if(dns) {
|
||||
/* Now add and HTTPSRR information if we have */
|
||||
#ifdef USE_HTTPSRR
|
||||
|
|
@ -1278,8 +1279,6 @@ CURLcode Curl_doh_is_resolved(struct Curl_easy *data,
|
|||
result = Curl_dnscache_add(data, dns);
|
||||
*dnsp = data->state.async.dns;
|
||||
}
|
||||
else
|
||||
Curl_freeaddrinfo(ai);
|
||||
} /* address processing done */
|
||||
|
||||
/* All done */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue