]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
fix: add check for NULL zalloc in tls-provider.c (reverse if statement)
authorBurkov Egor <eburkov@rvision.ru>
Tue, 18 Feb 2025 09:49:07 +0000 (12:49 +0300)
committerTomas Mraz <tomas@openssl.org>
Thu, 20 Feb 2025 08:44:51 +0000 (09:44 +0100)
CLA: trivial

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/26814)

(cherry picked from commit c5eb70de753605cda978fda9a4eddbdb1fc692be)

test/tls-provider.c

index be47f77d5cbc0997a9a9d438d7a7499974e4db76..d7304f28f941bf9170766337910fcc9215644e5f 100644 (file)
@@ -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;