]> granicus.if.org Git - curl/commitdiff
Check for a NULL easy->easy_conn in multi_getsock() since it can in fact
authorDaniel Stenberg <daniel@haxx.se>
Sat, 31 Mar 2007 10:56:07 +0000 (10:56 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Sat, 31 Mar 2007 10:56:07 +0000 (10:56 +0000)
happen when curl_multi_remove_handle() is called.
CID 13. coverity.com scan

lib/multi.c

index 2a4f1a16c27a8071541b4093c5988d133a5dfcb0..ec9fd3309c1f9001250f4d9db96aeacdc11568a1 100644 (file)
@@ -680,7 +680,14 @@ static int multi_getsock(struct Curl_one_easy *easy,
                                                  of sockets */
                          int numsocks)
 {
-  if (easy->easy_handle->state.pipe_broke) {
+  /* If the pipe broke, or if there's no connection left for this easy handle,
+     then we MUST bail out now with no bitmask set. The no connection case can
+     happen when this is called from curl_multi_remove_handle() =>
+     singlesocket() => multi_getsock().
+  */
+
+  if (easy->easy_handle->state.pipe_broke ||
+      !easy->easy_conn) {
     return 0;
   }