From c8373e3dfc324e51f2221fefc4edff69d00f933c Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 4 Jul 2018 00:58:39 +0200 Subject: ares: check for NULL in completed-callback --- lib/asyn-ares.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'lib') diff --git a/lib/asyn-ares.c b/lib/asyn-ares.c index 00fe1adb5..5cfb2602d 100644 --- a/lib/asyn-ares.c +++ b/lib/asyn-ares.c @@ -475,17 +475,19 @@ static void query_completed_cb(void *arg, /* (struct connectdata *) */ return; res = (struct ResolverResults *)conn->async.os_specific; - res->num_pending--; + if(res) { + res->num_pending--; - if(CURL_ASYNC_SUCCESS == status) { - Curl_addrinfo *ai = Curl_he2ai(hostent, conn->async.port); - if(ai) { - compound_results(res, ai); + if(CURL_ASYNC_SUCCESS == status) { + Curl_addrinfo *ai = Curl_he2ai(hostent, conn->async.port); + if(ai) { + compound_results(res, ai); + } } + /* A successful result overwrites any previous error */ + if(res->last_status != ARES_SUCCESS) + res->last_status = status; } - /* A successful result overwrites any previous error */ - if(res->last_status != ARES_SUCCESS) - res->last_status = status; } /* -- cgit v1.2.3