From bba59073c52e6dd00ddc18e0e40d1f7dfc1c9315 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 23 May 2017 10:32:18 +0200 Subject: redirect: store the "would redirect to" URL when max redirs is reached Test 1261 added to verify. Reported-by: Lloyd Fournier Fixes #1489 Closes #1497 --- lib/multi.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'lib/multi.c') diff --git a/lib/multi.c b/lib/multi.c index 09be44396..4b2872743 100644 --- a/lib/multi.c +++ b/lib/multi.c @@ -1715,20 +1715,18 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, else { /* Follow failed */ result = drc; - free(newurl); } } else { /* done didn't return OK or SEND_ERROR */ result = drc; - free(newurl); } } else { /* Have error handler disconnect conn if we can't retry */ stream_error = TRUE; - free(newurl); } + free(newurl); } else { /* failure detected */ @@ -1963,9 +1961,6 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, if(!result) { multistate(data, CURLM_STATE_CONNECT); rc = CURLM_CALL_MULTI_PERFORM; - newurl = NULL; /* handed over the memory ownership to - Curl_follow(), make sure we don't free() it - here */ } } } @@ -1979,9 +1974,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, newurl = data->req.location; data->req.location = NULL; result = Curl_follow(data, newurl, FOLLOW_FAKE); - if(!result) - newurl = NULL; /* allocation was handed over Curl_follow() */ - else + if(result) stream_error = TRUE; } -- cgit v1.2.3