mirror of
https://github.com/dart-lang/sdk
synced 2024-10-14 09:58:32 +00:00
[vm] Fix memory leak freeing boringssl stack types.
TEST=lsan Bug: https://github.com/dart-lang/sdk/issues/54765 Change-Id: Ibd22bb77d2941da33ac3afeb1ab8c7c0bcd3d267 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349411 Reviewed-by: Brian Quinlan <bquinlan@google.com> Commit-Queue: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
parent
2998703466
commit
9d3e923bf3
|
@ -152,8 +152,8 @@ class ScopedSSLStackType {
|
|||
|
||||
~ScopedSSLStackType() {
|
||||
if (obj_ != nullptr) {
|
||||
func(reinterpret_cast<E*>(
|
||||
OPENSSL_sk_pop(reinterpret_cast<OPENSSL_STACK*>(obj_))));
|
||||
OPENSSL_sk_pop_free_ex(reinterpret_cast<OPENSSL_STACK*>(obj_),
|
||||
call_free_func, free_func);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -167,6 +167,11 @@ class ScopedSSLStackType {
|
|||
}
|
||||
|
||||
private:
|
||||
static void free_func(void* element) { func(reinterpret_cast<E*>(element)); }
|
||||
static void call_free_func(void (*free_func)(void*), void* element) {
|
||||
free_func(element);
|
||||
}
|
||||
|
||||
T* obj_;
|
||||
|
||||
DISALLOW_ALLOCATION();
|
||||
|
|
Loading…
Reference in a new issue