diff --git a/src/common/linux/libcurl_wrapper.cc b/src/common/linux/libcurl_wrapper.cc index 09668161..a53087d9 100644 --- a/src/common/linux/libcurl_wrapper.cc +++ b/src/common/linux/libcurl_wrapper.cc @@ -47,6 +47,7 @@ LibcurlWrapper::LibcurlWrapper() LibcurlWrapper::~LibcurlWrapper() { if (init_ok_) { (*easy_cleanup_)(curl_); + (*global_cleanup_)(); dlclose(curl_lib_); } } @@ -262,6 +263,10 @@ bool LibcurlWrapper::SetFunctionPointers() { SET_AND_CHECK_FUNCTION_POINTER(formfree_, "curl_formfree", void(*)(curl_httppost*)); + + SET_AND_CHECK_FUNCTION_POINTER(global_cleanup_, + "curl_global_cleanup", + void(*)(void)); return true; } diff --git a/src/common/linux/libcurl_wrapper.h b/src/common/linux/libcurl_wrapper.h index f4a4dca4..f8f961c1 100644 --- a/src/common/linux/libcurl_wrapper.h +++ b/src/common/linux/libcurl_wrapper.h @@ -39,6 +39,9 @@ #include "third_party/curl/curl.h" namespace google_breakpad { + +// This class is only safe to be used on single-threaded code because of its +// usage of libcurl's curl_global_cleanup(). class LibcurlWrapper { public: LibcurlWrapper(); @@ -111,6 +114,7 @@ class LibcurlWrapper { CURLcode (*easy_getinfo_)(CURL*, CURLINFO info, ...); void (*easy_reset_)(CURL*); void (*formfree_)(struct curl_httppost*); + void (*global_cleanup_)(void); }; }