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 10:58:59 +0200
commit1eca278bbd6135295794b479fc4948f6b343d58e (patch)
tree65a3723cf7633b1d00002bb7838bbeee87f4b2f8
parent7ae78feea3f7fe74e791af72dc3c124d20e7c062 (diff)
downloadcurl-bagder/http-error-memleak.tar.gz
multi: fix location URL memleak in error pathbagder/http-error-memleak
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);