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.6.0-alpha1~606 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=443298e0f0e2c8225f8c6d6fdc01c6c4d434028b;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) --- diff --git a/providers/implementations/keymgmt/ecx_kmgmt.c b/providers/implementations/keymgmt/ecx_kmgmt.c index dfa2e006212..b3ff3bf097d 100644 --- a/providers/implementations/keymgmt/ecx_kmgmt.c +++ b/providers/implementations/keymgmt/ecx_kmgmt.c @@ -510,15 +510,15 @@ static void *ecx_gen_init(void *provctx, int selection, if (algdesc != NULL && !ossl_FIPS_IND_callback(libctx, algdesc, "KeyGen Init")) { OPENSSL_free(gctx); - return 0; + return NULL; } #endif + } 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; }