]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
multi interface: only use non-NULL function pointer!
authorDaniel Stenberg <daniel@haxx.se>
Fri, 2 Dec 2011 20:10:28 +0000 (21:10 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 2 Dec 2011 20:10:28 +0000 (21:10 +0100)
If the socket callback function pointer hasn't been set, we must not
attempt to use it. Commit adc88ca20 made it more likely to occur.

lib/multi.c

index 3059e49be012ac340c0e4375a6a76198113818b4..f3b892c912c0ebed51689b70d146e21c2443802c 100644 (file)
@@ -1940,11 +1940,12 @@ static void singlesocket(struct Curl_multi *multi,
     }
 
     /* we know (entry != NULL) at this point, see the logic above */
-    multi->socket_cb(easy->easy_handle,
-                     s,
-                     action,
-                     multi->socket_userp,
-                     entry->socketp);
+    if(multi->socket_cb)
+      multi->socket_cb(easy->easy_handle,
+                       s,
+                       action,
+                       multi->socket_userp,
+                       entry->socketp);
 
     entry->action = action; /* store the current action state */
   }
@@ -2019,11 +2020,12 @@ static void singlesocket(struct Curl_multi *multi,
         remove_sock_from_hash = FALSE;
 
       if(remove_sock_from_hash) {
-        multi->socket_cb(easy->easy_handle,
-                         s,
-                         CURL_POLL_REMOVE,
-                         multi->socket_userp,
-                         entry ? entry->socketp : NULL);
+        if(multi->socket_cb)
+          multi->socket_cb(easy->easy_handle,
+                           s,
+                           CURL_POLL_REMOVE,
+                           multi->socket_userp,
+                           entry ? entry->socketp : NULL);
         sh_delentry(multi->sockhash, s);
       }