From 271ec6b9b6276499b9e45083611e1d08d951b59a Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Sat, 4 Jan 2020 16:27:56 +0100 Subject: curl: cleanup multi handle on failure ... to fix memory leak in error path. Fixes #4772 Closes #4780 Reported-by: Brian Carpenter --- src/tool_operate.c | 6 ++++-- 1 file 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, , et al. + * Copyright (C) 1998 - 2020, Daniel Stenberg, , 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); -- cgit v1.2.1