From 08ea467bfe3e04a197bd3ab0460fa8cb45a2969d Mon Sep 17 00:00:00 2001 From: Desour Date: Fri, 3 Mar 2023 15:03:19 +0100 Subject: [PATCH] Use unique_ptr for g_httpfetch_thread --- src/httpfetch.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/httpfetch.cpp b/src/httpfetch.cpp index 460ad5c5c..0e1b55b0b 100644 --- a/src/httpfetch.cpp +++ b/src/httpfetch.cpp @@ -734,7 +734,7 @@ protected: } }; -CurlFetchThread *g_httpfetch_thread = NULL; +std::unique_ptr g_httpfetch_thread = nullptr; void httpfetch_init(int parallel_limit) { @@ -744,7 +744,7 @@ void httpfetch_init(int parallel_limit) CURLcode res = curl_global_init(CURL_GLOBAL_DEFAULT); FATAL_ERROR_IF(res != CURLE_OK, "CURL init failed"); - g_httpfetch_thread = new CurlFetchThread(parallel_limit); + g_httpfetch_thread = std::make_unique(parallel_limit); // Initialize g_callerid_randomness for httpfetch_caller_alloc_secure u64 randbuf[2]; @@ -760,7 +760,7 @@ void httpfetch_cleanup() g_httpfetch_thread->stop(); g_httpfetch_thread->requestWakeUp(); g_httpfetch_thread->wait(); - delete g_httpfetch_thread; + g_httpfetch_thread.reset(); } curl_global_cleanup();