From 6c93fa3919c36f1993aa26901f260d58c0aecb96 Mon Sep 17 00:00:00 2001 From: Bartel Artem Date: Wed, 11 Jun 2025 06:58:31 +0300 Subject: [PATCH] return NULL if gctx allocation fails. Reviewed-by: Tomas Mraz Reviewed-by: Paul Yang Reviewed-by: Neil Horman (Merged from https://github.com/openssl/openssl/pull/27795) (cherry picked from commit 443298e0f0e2c8225f8c6d6fdc01c6c4d434028b) --- providers/implementations/keymgmt/ecx_kmgmt.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/providers/implementations/keymgmt/ecx_kmgmt.c b/providers/implementations/keymgmt/ecx_kmgmt.c index 56af353c611..e0e74fcc76d 100644 --- a/providers/implementations/keymgmt/ecx_kmgmt.c +++ b/providers/implementations/keymgmt/ecx_kmgmt.c @@ -486,12 +486,12 @@ static void *ecx_gen_init(void *provctx, int selection, gctx->libctx = libctx; gctx->type = type; gctx->selection = selection; + } else { + return NULL; } if (!ecx_gen_set_params(gctx, params)) { - if (gctx != NULL) { - ecx_gen_cleanup(gctx); - gctx = NULL; - } + ecx_gen_cleanup(gctx); + gctx = NULL; } return gctx; } -- 2.47.2