From: Burkov Egor Date: Tue, 18 Feb 2025 09:49:07 +0000 (+0300) Subject: fix: add check for NULL zalloc in tls-provider.c (reverse if statement) X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f9dcb2bd17753e5dc674a029dc2d780033f8b219;p=thirdparty%2Fopenssl.git 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) --- diff --git a/test/tls-provider.c b/test/tls-provider.c index be47f77d5cb..d7304f28f94 100644 --- a/test/tls-provider.c +++ b/test/tls-provider.c @@ -594,9 +594,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; /* Our provctx is really just an OSSL_LIB_CTX */ gctx->libctx = (OSSL_LIB_CTX *)provctx;