]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
ares: check for NULL in completed-callback
authorDaniel Stenberg <daniel@haxx.se>
Tue, 3 Jul 2018 22:58:39 +0000 (00:58 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 11 Jul 2018 21:41:24 +0000 (23:41 +0200)
lib/asyn-ares.c

index 00fe1adb580cdd51a90cdbc30c50a4260cff6bfd..5cfb2602df71b82ff8ef60edd989f0b06c464240 100644 (file)
@@ -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;
 }
 
 /*