Fix a potential memory leak in tls_ctx_use_management_external_key
PATCH 1/1 Fix a potential memory leak in tls_ctx_use_management_external_key
From: Selva Nair <[email protected]...>
As pointed out by Gert Doering <[email protected]...>
---
To be applied after 06/18 of xkey patchset
src/openvpn/ssl_openssl.c | 1 + 1 file changed, 1 insertion(+)
src/openvpn/ssl_openssl.c +1 -0
@@ -1493,6 +1493,7 @@ tls_ctx_use_management_external_key(struct tls_root_ctx *ctx)if (!privkey || !SSL_CTX_use_PrivateKey (ctx->ctx, privkey)) { +EVP_PKEY_free (privkey); goto cleanup; }EVP_PKEY_free (privkey);
Signature · 1 line
2.30.2
Hi,
Quoted 3 lines · On 20/01/2022 17:26, [email protected]... wrote:
From: Selva Nair <[email protected]...>
As pointed out by Gert Doering <[email protected]...>
This can be "gitified" as:
Quoted 13 lines
Signed-off-by Selva Nair <[email protected]...>---
To be applied after 06/18 of xkey patchsetsrc/openvpn/ssl_openssl.c | 1 + 1 file changed, 1 insertion(+)src/openvpn/ssl_openssl.c +0
-0
src/openvpn/ssl_openssl.c tls_ctx_use_management_external_key(struct tls_root_ctx *ctx) · line 1499
Quoted 7 lines
src/openvpn/ssl_openssl.c +1
-0@@ -1493,6 +1493,7 @@ tls_ctx_use_management_external_key(struct tls_root_ctx *ctx)if (!privkey || !SSL_CTX_use_PrivateKey (ctx->ctx, privkey)) { +EVP_PKEY_free (privkey); goto cleanup; }EVP_PKEY_free (privkey);
This is non-crucial because we goto cleanup and then do a M_FATAL.
Nonetheless, we should strive to have cleaner error paths that take care of releasing allocated resources when possible.
Signature · 1 line
Antonio Quartulli
Thanks.
Even if, as Antonio noticed, we will only leak memory for a very short time before hitting the M_FATAL message in "cleanup"...
Your patch has been applied to the master branch.
commit 0f7cd474118deeced48168ed9cec0806e7f4cc15
Author: Selva Nair Date: Thu Jan 20 11:26:45 2022 -0500
Fix a potential memory leak in tls_ctx_use_management_external_key
Signed-off-by: Selva Nair <[email protected]...>
Acked-by: Antonio Quartulli <[email protected]...>
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg23610.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering