aboutsummaryrefslogtreecommitdiff
path: root/lib/multi.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2009-08-21 12:01:36 +0000
committerDaniel Stenberg <daniel@haxx.se>2009-08-21 12:01:36 +0000
commit8b5102ca835d73d5cc633f1e7b8d05b3a8082f61 (patch)
tree0fd77ac2f297a551ff7c6b93298e944f2cd6bbbf /lib/multi.c
parent1048043963d5487ed4d70f426a85aff07c2ee5f1 (diff)
- Andre Guibert de Bruet pointed out a missing return code check for a
strdup() that could lead to segfault if it returned NULL. I extended his suggest patch to now have Curl_retry_request() return a regular return code and better check that.
Diffstat (limited to 'lib/multi.c')
-rw-r--r--lib/multi.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/lib/multi.c b/lib/multi.c
index 1099b525d..686372ad1 100644
--- a/lib/multi.c
+++ b/lib/multi.c
@@ -1183,7 +1183,16 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
char *newurl;
followtype follow=FOLLOW_NONE;
CURLcode drc;
- bool retry = Curl_retry_request(easy->easy_conn, &newurl);
+ bool retry = FALSE;
+
+ drc = Curl_retry_request(easy->easy_conn, &newurl);
+ if(drc) {
+ /* a failure here pretty much implies an out of memory */
+ easy->result = drc;
+ disconnect_conn = TRUE;
+ }
+ else
+ retry = newurl?TRUE:FALSE;
Curl_posttransfer(easy->easy_handle);
drc = Curl_done(&easy->easy_conn, easy->result, FALSE);
@@ -1370,9 +1379,13 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
}
else if(TRUE == done) {
char *newurl;
- bool retry = Curl_retry_request(easy->easy_conn, &newurl);
+ bool retry = FALSE;
followtype follow=FOLLOW_NONE;
+ easy->result = Curl_retry_request(easy->easy_conn, &newurl);
+ if(!easy->result)
+ retry = newurl?TRUE:FALSE;
+
/* call this even if the readwrite function returned error */
Curl_posttransfer(easy->easy_handle);
@@ -1406,7 +1419,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
multistate(easy, CURLM_STATE_CONNECT);
result = CURLM_CALL_MULTI_PERFORM;
}
- else
+ else if(newurl)
/* Since we "took it", we are in charge of freeing this on
failure */
free(newurl);