asyn-ares: handle no connection in the addrinfo callback

To avoid crashing.

Follow-up from 56a4db2
Closes #12219
This commit is contained in:
Daniel Stenberg 2023-10-28 00:22:49 +02:00
parent 68673c3e9e
commit 91188c6480
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -729,14 +729,16 @@ static void addrinfo_cb(void *arg, int status, int timeouts,
struct ares_addrinfo *result)
{
struct Curl_easy *data = (struct Curl_easy *)arg;
struct thread_data *res = data->conn->resolve_async.tdata;
(void)timeouts;
if(ARES_SUCCESS == status) {
res->temp_ai = ares2addr(result->nodes);
res->last_status = CURL_ASYNC_SUCCESS;
ares_freeaddrinfo(result);
if(data->conn) {
struct thread_data *res = data->conn->resolve_async.tdata;
(void)timeouts;
if(ARES_SUCCESS == status) {
res->temp_ai = ares2addr(result->nodes);
res->last_status = CURL_ASYNC_SUCCESS;
ares_freeaddrinfo(result);
}
res->num_pending--;
}
res->num_pending--;
}
#endif