From d0fa8c70708b0d53bd03d353ffd8827f0ded7e0e Mon Sep 17 00:00:00 2001 From: plmzod <64476649+plmzod@users.noreply.github.com> Date: Sat, 28 Sep 2024 00:21:43 +0200 Subject: [PATCH] Fix memory leaks in SocketMbedTLS when closing. (#527) --- ixwebsocket/IXSocketMbedTLS.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ixwebsocket/IXSocketMbedTLS.cpp b/ixwebsocket/IXSocketMbedTLS.cpp index b3b73256..33843020 100644 --- a/ixwebsocket/IXSocketMbedTLS.cpp +++ b/ixwebsocket/IXSocketMbedTLS.cpp @@ -321,6 +321,11 @@ namespace ix mbedtls_entropy_free(&_entropy); mbedtls_x509_crt_free(&_cacert); mbedtls_x509_crt_free(&_cert); + mbedtls_pk_free(&_pkey); + if (MBEDTLS_VERSION_MAJOR >= 3 && MBEDTLS_VERSION_MINOR >= 6 && MBEDTLS_VERSION_PATCH >= 0) + { + mbedtls_psa_crypto_free(); + } Socket::close(); }