check gctx for NULL before cleanup.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Yang <kaishen.yy@antfin.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27795)

(cherry picked from commit 02f9c9342d)
This commit is contained in:
Bartel Artem 2025-06-10 13:11:41 +03:00 committed by Neil Horman
parent ccef4e8b8e
commit 7cabaa71be
1 changed files with 4 additions and 2 deletions

View File

@ -510,9 +510,11 @@ static void *ecx_gen_init(void *provctx, int selection,
#endif #endif
} }
if (!ecx_gen_set_params(gctx, params)) { if (!ecx_gen_set_params(gctx, params)) {
if (gctx != NULL) {
ecx_gen_cleanup(gctx); ecx_gen_cleanup(gctx);
gctx = NULL; gctx = NULL;
} }
}
return gctx; return gctx;
} }