mirror of
https://github.com/curl/curl.git
synced 2025-01-24 14:15:18 +08:00
asyn-ares: handle no connection in the addrinfo callback
To avoid crashing.
Follow-up from 56a4db2
Closes #12219
This commit is contained in:
parent
68673c3e9e
commit
91188c6480
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user