1
0
mirror of https://github.com/moparisthebest/curl synced 2024-08-13 17:03:50 -04:00

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)) { if(!drc || (drc == CURLE_SEND_ERROR)) {
follow = FOLLOW_RETRY; follow = FOLLOW_RETRY;
drc = Curl_follow(data, newurl, follow); drc = Curl_follow(data, newurl, follow);
newurl = NULL; /* freed by Curl_follow() */
if(!drc) { if(!drc) {
multistate(data, CURLM_STATE_CONNECT); multistate(data, CURLM_STATE_CONNECT);
rc = CURLM_CALL_MULTI_PERFORM; 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); data->change.referer = strdup(data->change.url);
if(!data->change.referer) if(!data->change.referer) {
free(newurl);
return CURLE_OUT_OF_MEMORY; return CURLE_OUT_OF_MEMORY;
}
data->change.referer_alloc = TRUE; /* yes, free this later */ data->change.referer_alloc = TRUE; /* yes, free this later */
} }
} }