From 98be2e8fb60aaece2e4c3d42e87671fe22c081a2 Mon Sep 17 00:00:00 2001 From: Niels Dossche Date: Wed, 20 Nov 2024 19:57:38 +0100 Subject: [PATCH] Fix potential memory leak on failure of ecx_gen_init() When ecx_gen_set_params() returns 0, it could have duplicated the memory for the parameter OSSL_KDF_PARAM_PROPERTIES already in gctx->propq, leading to a memory leak. Reviewed-by: Paul Dale Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/26015) --- providers/implementations/keymgmt/ecx_kmgmt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/providers/implementations/keymgmt/ecx_kmgmt.c b/providers/implementations/keymgmt/ecx_kmgmt.c index 5e9b80fc48..b8d316ba8e 100644 --- a/providers/implementations/keymgmt/ecx_kmgmt.c +++ b/providers/implementations/keymgmt/ecx_kmgmt.c @@ -510,7 +510,7 @@ static void *ecx_gen_init(void *provctx, int selection, #endif } if (!ecx_gen_set_params(gctx, params)) { - OPENSSL_free(gctx); + ecx_gen_cleanup(gctx); gctx = NULL; } return gctx;