]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
curl: cleanup multi handle on failure
authorDaniel Stenberg <daniel@haxx.se>
Sat, 4 Jan 2020 15:27:56 +0000 (16:27 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Sat, 4 Jan 2020 22:05:21 +0000 (23:05 +0100)
... to fix memory leak in error path.

Fixes #4772
Closes #4780
Reported-by: Brian Carpenter
src/tool_operate.c

index 61b13067238e7bf3b4252c25c4efb8dc943808a1..9dc59b2e9ba4f7906847d2119e0e9bb8d25a89e8 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -2105,8 +2105,10 @@ static CURLcode parallel_transfers(struct GlobalConfig *global,
 
   result = add_parallel_transfers(global, multi, share,
                                   &more_transfers, &added_transfers);
-  if(result)
+  if(result) {
+    curl_multi_cleanup(multi);
     return result;
+  }
 
   while(!mcode && (still_running || more_transfers)) {
     mcode = curl_multi_poll(multi, NULL, 0, 1000, NULL);