From 5a6f56f1d318a8a604339272466ccd1d06825a85 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Sat, 21 Sep 2024 20:29:59 +0200 Subject: [PATCH] [curl] Do not cleanup twice at exit --- src/protocol/curl/ftp.c | 8 ++++++-- src/protocol/curl/http.c | 7 +++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/protocol/curl/ftp.c b/src/protocol/curl/ftp.c index 0e7e4bfbd..7c8493c8b 100644 --- a/src/protocol/curl/ftp.c +++ b/src/protocol/curl/ftp.c @@ -37,6 +37,7 @@ #include "config/options.h" #include "intl/libintl.h" #include "main/select.h" +#include "main/main.h" #include "main/module.h" #include "network/connection.h" #include "network/progress.h" @@ -383,8 +384,11 @@ done_ftpes(struct connection *conn) if (!ftp || !ftp->easy) { return; } - curl_multi_remove_handle(g.multi, ftp->easy); - curl_easy_cleanup(ftp->easy); + + if (!program.terminate) { + curl_multi_remove_handle(g.multi, ftp->easy); + curl_easy_cleanup(ftp->easy); + } } static void diff --git a/src/protocol/curl/http.c b/src/protocol/curl/http.c index 90fe729a3..84a1c840d 100644 --- a/src/protocol/curl/http.c +++ b/src/protocol/curl/http.c @@ -40,6 +40,7 @@ #include "config/options.h" #include "intl/libintl.h" #include "main/select.h" +#include "main/main.h" #include "main/module.h" #include "network/connection.h" #include "network/progress.h" @@ -116,8 +117,10 @@ done_http_curl(struct connection *conn) if (!http || !http->easy) { return; } - curl_multi_remove_handle(g.multi, http->easy); - curl_easy_cleanup(http->easy); + if (!program.terminate) { + curl_multi_remove_handle(g.multi, http->easy); + curl_easy_cleanup(http->easy); + } done_string(&http->headers); done_string(&http->post_headers); mem_free_if(http->post_buffer);