curl: cleanup multi handle on failure

... to fix memory leak in error path.

Fixes #4772
Closes #4780
Reported-by: Brian Carpenter
This commit is contained in:
Daniel Stenberg 2020-01-04 16:27:56 +01:00
parent 291ed52122
commit 271ec6b9b6
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
1 changed files with 4 additions and 2 deletions

View 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);