diff --git a/runtime/bin/secure_socket_utils.h b/runtime/bin/secure_socket_utils.h index 47f2f60af03..a129bf72ce4 100644 --- a/runtime/bin/secure_socket_utils.h +++ b/runtime/bin/secure_socket_utils.h @@ -152,8 +152,8 @@ class ScopedSSLStackType { ~ScopedSSLStackType() { if (obj_ != nullptr) { - func(reinterpret_cast( - OPENSSL_sk_pop(reinterpret_cast(obj_)))); + OPENSSL_sk_pop_free_ex(reinterpret_cast(obj_), + call_free_func, free_func); } } @@ -167,6 +167,11 @@ class ScopedSSLStackType { } private: + static void free_func(void* element) { func(reinterpret_cast(element)); } + static void call_free_func(void (*free_func)(void*), void* element) { + free_func(element); + } + T* obj_; DISALLOW_ALLOCATION();