]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
crypto/mem.c optimize ossl_(un)likely
authorNorbert Pocs <norbertp@openssl.org>
Thu, 3 Jul 2025 13:58:52 +0000 (15:58 +0200)
committerNeil Horman <nhorman@openssl.org>
Wed, 16 Jul 2025 17:07:15 +0000 (13:07 -0400)
Signed-off-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27961)

crypto/mem.c

index c6cdfb36e1e6a2ff55ace72d2bf0ac735fddd1e2..be5b040669d7406c881db92ada317130afe910c9 100644 (file)
@@ -195,7 +195,7 @@ void *CRYPTO_malloc(size_t num, const char *file, int line)
         goto err;
     }
 
-    if (num == 0)
+    if (ossl_unlikely(num == 0))
         return NULL;
 
     FAILTEST();
@@ -209,7 +209,7 @@ void *CRYPTO_malloc(size_t num, const char *file, int line)
     }
 
     ptr = malloc(num);
-    if (ptr != NULL)
+    if (ossl_likely(ptr != NULL))
         return ptr;
  err:
     /*