aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2013-03-09 18:05:28 +0100
committerDaniel Stenberg <daniel@haxx.se>2013-03-09 22:27:15 +0100
commit64b2d2d77e112f1519995b54cb0806e1f2e4a9f6 (patch)
tree26d7e594da81b7664e5cb537d43f48e26f4893fc
parent88264355710392d0536a1e11a5426fa6507a50f8 (diff)
multi_runsingle: avoid NULL dereference
When Curl_do() returns failure, the connection pointer could be NULL so the code path following needs to that that into account. Bug: http://curl.haxx.se/mail/lib-2013-03/0062.html Reported by: Eric Hu
-rw-r--r--lib/multi.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/multi.c b/lib/multi.c
index 706df2398..825f77740 100644
--- a/lib/multi.c
+++ b/lib/multi.c
@@ -1202,8 +1202,9 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
}
else {
/* Perform the protocol's DO action */
- easy->result = Curl_do(&easy->easy_conn,
- &dophase_done);
+ easy->result = Curl_do(&easy->easy_conn, &dophase_done);
+
+ /* When Curl_do() returns failure, easy->easy_conn might be NULL! */
if(CURLE_OK == easy->result) {
if(!dophase_done) {
@@ -1292,7 +1293,8 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
else {
/* failure detected */
Curl_posttransfer(data);
- Curl_done(&easy->easy_conn, easy->result, FALSE);
+ if(easy->easy_conn)
+ Curl_done(&easy->easy_conn, easy->result, FALSE);
disconnect_conn = TRUE;
}
}