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-Tag: openssl-3.0.17~102 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7060afbf6c1888c280e572ad59ea11f008d15417;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 7375792c312..e16b82c976b 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;