multi: fix location URL memleak in error path

Follow-up to #3044 - fix a leak OSS-Fuzz detected
Closes #3057
This commit is contained in:
Daniel Stenberg 2018-09-28 10:58:28 +02:00
parent f8215f80ab
commit 454fa3fd7b
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
1 changed files with 4 additions and 1 deletions

View File

@ -1984,7 +1984,10 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
else
follow = FOLLOW_RETRY;
result = multi_done(&data->easy_conn, CURLE_OK, FALSE);
if(!result) {
if(result)
/* Curl_follow() would otherwise free this */
free(newurl);
else {
result = Curl_follow(data, newurl, follow);
if(!result) {
multistate(data, CURLM_STATE_CONNECT);