From: Bartel Artem Date: Tue, 10 Jun 2025 10:11:41 +0000 (+0300) Subject: check gctx for NULL before cleanup. X-Git-Tag: openssl-3.0.17~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7ab85dca09b6ec92e0e9586f27e57151f6889aaa;p=thirdparty%2Fopenssl.git check gctx for NULL before cleanup. 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 02f9c9342d54c99981b0a83088982bf0d1083d7f) --- diff --git a/providers/implementations/keymgmt/ecx_kmgmt.c b/providers/implementations/keymgmt/ecx_kmgmt.c index 51bdaba4a05..45871fd5778 100644 --- a/providers/implementations/keymgmt/ecx_kmgmt.c +++ b/providers/implementations/keymgmt/ecx_kmgmt.c @@ -487,8 +487,10 @@ static void *ecx_gen_init(void *provctx, int selection, gctx->selection = selection; } if (!ecx_gen_set_params(gctx, params)) { - ecx_gen_cleanup(gctx); - gctx = NULL; + if (gctx != NULL) { + ecx_gen_cleanup(gctx); + gctx = NULL; + } } return gctx; }