From 7d0a58e7e06e12cef26d169054cabb6b88dba9d2 Mon Sep 17 00:00:00 2001 From: Burkov Egor Date: Tue, 18 Feb 2025 12:49:07 +0300 Subject: [PATCH] fix: add check for NULL zalloc in tls-provider.c (reverse if statement) CLA: trivial Reviewed-by: Shane Lontis Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/26814) (cherry picked from commit c5eb70de753605cda978fda9a4eddbdb1fc692be) --- test/tls-provider.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/tls-provider.c b/test/tls-provider.c index 586d87e3979..7d619d6aa7f 100644 --- a/test/tls-provider.c +++ b/test/tls-provider.c @@ -930,9 +930,10 @@ static void *xor_gen_init(void *provctx, int selection, | OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS)) == 0) return NULL; - if ((gctx = OPENSSL_zalloc(sizeof(*gctx))) != NULL) - gctx->selection = selection; + if ((gctx = OPENSSL_zalloc(sizeof(*gctx))) == NULL) + return NULL; + gctx->selection = selection; gctx->libctx = PROV_XOR_LIBCTX_OF(provctx); if (!xor_gen_set_params(gctx, params)) { -- 2.47.2