]> 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:33 +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 d8ec7c2dc2ae8e3939230c0fc05b4433e7df19df..eb0a1cc94b15f917b02bdaea6770ad87f735043f 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)) {