mirror of
https://github.com/curl/curl.git
synced 2026-07-26 06:57:16 +03:00
multi: avoid memory-leak risk
'newurl' is allocated in some conditions and used in a few scenarios, but there were theoretical combinations in which it would not get freed. Move the free to happen unconditionally. Never triggered by tests, but spotted by Coverity. Closes #13471
This commit is contained in:
parent
31d7cf42fd
commit
3572dd65bb
1 changed files with 1 additions and 2 deletions
|
|
@ -2530,7 +2530,6 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
|
|||
multistate(data, MSTATE_SETUP);
|
||||
rc = CURLM_CALL_MULTI_PERFORM;
|
||||
}
|
||||
free(newurl);
|
||||
}
|
||||
else {
|
||||
/* after the transfer is done, go DONE */
|
||||
|
|
@ -2542,7 +2541,6 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
|
|||
newurl = data->req.location;
|
||||
data->req.location = NULL;
|
||||
result = Curl_follow(data, newurl, FOLLOW_FAKE);
|
||||
free(newurl);
|
||||
if(result) {
|
||||
stream_error = TRUE;
|
||||
result = multi_done(data, result, TRUE);
|
||||
|
|
@ -2561,6 +2559,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
|
|||
transfers */
|
||||
Curl_expire(data, 0, EXPIRE_RUN_NOW);
|
||||
}
|
||||
free(newurl);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue