summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2020-01-04 16:27:56 +0100
committerDaniel Stenberg <daniel@haxx.se>2020-01-04 23:05:21 +0100
commit271ec6b9b6276499b9e45083611e1d08d951b59a (patch)
tree0217779a299a81b59fc25cb4dea9db33530c1263
parent291ed52122619c502432e00a5115057f51d21e6a (diff)
downloadcurl-271ec6b9b6276499b9e45083611e1d08d951b59a.tar.gz
curl: cleanup multi handle on failure
... to fix memory leak in error path. Fixes #4772 Closes #4780 Reported-by: Brian Carpenter
-rw-r--r--src/tool_operate.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/tool_operate.c b/src/tool_operate.c
index 61b130672..9dc59b2e9 100644
--- a/src/tool_operate.c
+++ b/src/tool_operate.c
@@ -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);