summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2018-09-28 10:58:28 +0200
committerDaniel Stenberg <daniel@haxx.se>2018-09-28 17:10:14 +0200
commit454fa3fd7be9b4a8d51d19d3515a3a935c3bf400 (patch)
tree06be9fdaa0b76c8c46cd671cebe1b9ef312b0a06
parentf8215f80abe3b3b037d037f891f5f94aad68b440 (diff)
downloadcurl-454fa3fd7be9b4a8d51d19d3515a3a935c3bf400.tar.gz
multi: fix location URL memleak in error path
Follow-up to #3044 - fix a leak OSS-Fuzz detected Closes #3057
-rw-r--r--lib/multi.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/multi.c b/lib/multi.c
index d5e09aab4..f20260977 100644
--- a/lib/multi.c
+++ b/lib/multi.c
@@ -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);