From 6f75dd735ff3adaba04efe6840bf0f415d944fd4 Mon Sep 17 00:00:00 2001 From: Vivien Nicolas Date: Wed, 2 Mar 2022 10:33:50 +0100 Subject: [PATCH] Fix a memory leak in src/crypto/CHIPCryptoPALOpenSSL.cpp (#15682) --- src/crypto/CHIPCryptoPALOpenSSL.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/crypto/CHIPCryptoPALOpenSSL.cpp b/src/crypto/CHIPCryptoPALOpenSSL.cpp index b181710cd281c5..b9597a63c6be52 100644 --- a/src/crypto/CHIPCryptoPALOpenSSL.cpp +++ b/src/crypto/CHIPCryptoPALOpenSSL.cpp @@ -1204,6 +1204,11 @@ CHIP_ERROR VerifyCertificateSigningRequest(const uint8_t * csr, size_t csr_lengt X509_REQ_free(x509_req); } + if (ec_key != nullptr) + { + EC_KEY_free(ec_key); + } + _logSSLError(); return error; }