mirror of
https://github.com/yuzu-emu/breakpad.git
synced 2024-12-02 23:44:30 +01: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
@ -47,6 +47,7 @@ LibcurlWrapper::LibcurlWrapper()
|
|||||||
LibcurlWrapper::~LibcurlWrapper() {
|
LibcurlWrapper::~LibcurlWrapper() {
|
||||||
if (init_ok_) {
|
if (init_ok_) {
|
||||||
(*easy_cleanup_)(curl_);
|
(*easy_cleanup_)(curl_);
|
||||||
|
(*global_cleanup_)();
|
||||||
dlclose(curl_lib_);
|
dlclose(curl_lib_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -262,6 +263,10 @@ bool LibcurlWrapper::SetFunctionPointers() {
|
|||||||
SET_AND_CHECK_FUNCTION_POINTER(formfree_,
|
SET_AND_CHECK_FUNCTION_POINTER(formfree_,
|
||||||
"curl_formfree",
|
"curl_formfree",
|
||||||
void(*)(curl_httppost*));
|
void(*)(curl_httppost*));
|
||||||
|
|
||||||
|
SET_AND_CHECK_FUNCTION_POINTER(global_cleanup_,
|
||||||
|
"curl_global_cleanup",
|
||||||
|
void(*)(void));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,6 +39,9 @@
|
|||||||
#include "third_party/curl/curl.h"
|
#include "third_party/curl/curl.h"
|
||||||
|
|
||||||
namespace google_breakpad {
|
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 {
|
class LibcurlWrapper {
|
||||||
public:
|
public:
|
||||||
LibcurlWrapper();
|
LibcurlWrapper();
|
||||||
@ -111,6 +114,7 @@ class LibcurlWrapper {
|
|||||||
CURLcode (*easy_getinfo_)(CURL*, CURLINFO info, ...);
|
CURLcode (*easy_getinfo_)(CURL*, CURLINFO info, ...);
|
||||||
void (*easy_reset_)(CURL*);
|
void (*easy_reset_)(CURL*);
|
||||||
void (*formfree_)(struct curl_httppost*);
|
void (*formfree_)(struct curl_httppost*);
|
||||||
|
void (*global_cleanup_)(void);
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user