]> granicus.if.org Git - curl/commitdiff
multi: fix location URL memleak in error path
authorDaniel Stenberg <daniel@haxx.se>
Fri, 28 Sep 2018 08:58:28 +0000 (10:58 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 28 Sep 2018 15:10:14 +0000 (17:10 +0200)
Follow-up to #3044 - fix a leak OSS-Fuzz detected
Closes #3057

lib/multi.c

index d5e09aab48e2bbe84607465d6455db107ff5e939..f2026097785d358b945765047cae24258f8aece2 100644 (file)
@@ -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);