]> 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:41:26 +0000 (09:41 +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 586d87e397984710ae09a912de110afd2ddb835e..7d619d6aa7f0900749505ed165dc5eb482ae0988 100644 (file)
@@ -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)) {