From: Bartel Artem Date: Wed, 11 Jun 2025 03:58:31 +0000 (+0300) Subject: return NULL if gctx allocation fails. X-Git-Tag: openssl-3.0.17~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2d868385260e38a194163d71ac762dbf662e74d7;p=thirdparty%2Fopenssl.git 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) --- diff --git a/providers/implementations/keymgmt/ecx_kmgmt.c b/providers/implementations/keymgmt/ecx_kmgmt.c index 45871fd5778..7313d3c0145 100644 --- a/providers/implementations/keymgmt/ecx_kmgmt.c +++ b/providers/implementations/keymgmt/ecx_kmgmt.c @@ -485,12 +485,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; }