Curl_follow: Always free the passed new URL

Closes #3124
This commit is contained in:
Michael Kaufmann 2018-10-10 22:53:50 +02:00
parent 3455b4b374
commit 6afe70a00b
2 changed files with 4 additions and 1 deletions

View File

@ -1725,6 +1725,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
if(!drc || (drc == CURLE_SEND_ERROR)) {
follow = FOLLOW_RETRY;
drc = Curl_follow(data, newurl, follow);
newurl = NULL; /* freed by Curl_follow() */
if(!drc) {
multistate(data, CURLM_STATE_CONNECT);
rc = CURLM_CALL_MULTI_PERFORM;

View File

@ -1500,8 +1500,10 @@ CURLcode Curl_follow(struct Curl_easy *data,
}
data->change.referer = strdup(data->change.url);
if(!data->change.referer)
if(!data->change.referer) {
free(newurl);
return CURLE_OUT_OF_MEMORY;
}
data->change.referer_alloc = TRUE; /* yes, free this later */
}
}