curl/multi-fix-location-URL-memleak-in-error-path.patch
2019-09-30 10:36:29 -04:00

31 lines
967 B
Diff

From 454fa3fd7be9b4a8d51d19d3515a3a935c3bf400 Mon Sep 17 00:00:00 2001
From: Daniel Stenberg <daniel@haxx.se>
Date: Fri, 28 Sep 2018 10:58:28 +0200
Subject: [PATCH 108/557] multi: fix location URL memleak in error path
Follow-up to #3044 - fix a leak OSS-Fuzz detected
Closes #3057
---
lib/multi.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/lib/multi.c b/lib/multi.c
index d5e09aa..f202609 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);
--
1.8.3.1