mirror of
https://github.com/yuzu-emu/breakpad
synced 2024-11-25 14:08:56 +00:00
LibcurlWrapper uses curl_global_cleanup
LibcurlWrapper is missing a curl_global_cleanup causing a memory leak. The curl_global_init is called automatically when calling curl_easy_init without first doing curl_global_init. BUG=chromium:1405410 TEST=units with asan Change-Id: I4982fd5265b0df91076ed428f1134a681a7f28c6 Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4189295 Reviewed-by: Joshua Peraza <jperaza@chromium.org>
This commit is contained in:
parent
236743ed04
commit
bae713be2e
2 changed files with 9 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue