From: Niels Dossche Date: Wed, 20 Nov 2024 18:57:38 +0000 (+0100) Subject: Fix potential memory leak on failure of ecx_gen_init() X-Git-Tag: openssl-3.5.0-alpha1~882 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=98be2e8fb60aaece2e4c3d42e87671fe22c081a2;p=thirdparty%2Fopenssl.git 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) --- diff --git a/providers/implementations/keymgmt/ecx_kmgmt.c b/providers/implementations/keymgmt/ecx_kmgmt.c index 5e9b80fc48b..b8d316ba8e9 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;