aboutsummaryrefslogtreecommitdiff
path: root/lib/multi.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2012-07-15 20:31:37 +0200
committerDaniel Stenberg <daniel@haxx.se>2012-07-15 20:33:11 +0200
commit9d1171693361622762dd078d7a1a7236d84f838e (patch)
tree30f18fb7f23f6ef91795e09f6436198ab4277ea1 /lib/multi.c
parentff318a6302a92ffb627ebffb397e8dc2420a96c0 (diff)
multi_runsingle: added precaution against easy_conn NULL pointer
In many states the easy_conn pointer is referenced and just assumed to be working. This is an added extra check since analyzing indicates there's a risk we can end up in these states with a NULL pointer there.
Diffstat (limited to 'lib/multi.c')
-rw-r--r--lib/multi.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/multi.c b/lib/multi.c
index f4e15c413..ff43378f5 100644
--- a/lib/multi.c
+++ b/lib/multi.c
@@ -984,6 +984,16 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
break;
}
+ if(!easy->easy_conn &&
+ easy->state > CURLM_STATE_CONNECT &&
+ easy->state < CURLM_STATE_DONE) {
+ /* In all these states, the code will blindly access 'easy->easy_conn'
+ so this is precaution that it isn't NULL. And it silences static
+ analyzers. */
+ failf(data, "In state %d with no easy_conn, bail out!\n", easy->state);
+ return CURLM_INTERNAL_ERROR;
+ }
+
if(easy->easy_conn && easy->state > CURLM_STATE_CONNECT &&
easy->state < CURLM_STATE_COMPLETED)
/* Make sure we set the connection's current owner */