Commit 3a815c1481 for openssl.org
commit 3a815c1481ec43149b7a417d4b5b2aaf372d44e5
Author: Bob Beck <beck@openssl.org>
Date: Fri Nov 28 11:20:53 2025 -0700
Disable clang-format around line-wrap sensitive lines in malloc_test.c
If OPENSSL_LINE ends up on a different line than the following call here,
this test breaks.
We should perhaps reconsider if testing the reporting of OPENSSL_LINE
is what we want in a malloc test, but that's for another time than now.
Reviewed-by: Saša NedvÄ›dický <sashan@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29241)
diff --git a/test/mem_alloc_test.c b/test/mem_alloc_test.c
index 98283121a6..cf0a802ae1 100644
--- a/test/mem_alloc_test.c
+++ b/test/mem_alloc_test.c
@@ -433,26 +433,42 @@ static int test_xalloc(const bool secure, const bool array, const bool zero,
if (secure) {
if (array) {
if (zero)
+ /* clang-format off */
ln = OPENSSL_LINE, ret = OPENSSL_secure_calloc(td->nmemb, td->size);
+ /* clang-format on */
else
+ /* clang-format off */
ln = OPENSSL_LINE, ret = OPENSSL_secure_malloc_array(td->nmemb, td->size);
+ /* clang-format on */
} else {
if (zero)
+ /* clang-format off */
ln = OPENSSL_LINE, ret = OPENSSL_secure_zalloc(sz);
+ /* clang-format on */
else
+ /* clang-format off */
ln = OPENSSL_LINE, ret = OPENSSL_secure_malloc(sz);
+ /* clang-format on */
}
} else {
if (array) {
if (zero)
+ /* clang-format off */
ln = OPENSSL_LINE, ret = OPENSSL_calloc(td->nmemb, td->size);
+ /* clang-format on */
else
+ /* clang-format off */
ln = OPENSSL_LINE, ret = OPENSSL_malloc_array(td->nmemb, td->size);
+ /* clang-format on */
} else {
if (zero)
+ /* clang-format off*/
ln = OPENSSL_LINE, ret = OPENSSL_zalloc(sz);
+ /* clang-format on */
else
+ /* clang-format off*/
ln = OPENSSL_LINE, ret = OPENSSL_malloc(sz);
+ /* clang-format on */
}
}
} else {
@@ -549,14 +565,22 @@ static int test_xrealloc(const bool clear, const bool array, const bool macro,
if (macro) {
if (array) {
if (clear)
+ /* clang-format off */
ln = OPENSSL_LINE, ret = OPENSSL_clear_realloc_array(ret, old_nmemb, nmemb, td->size);
+ /* clang-format on */
else
+ /* clang-format off */
ln = OPENSSL_LINE, ret = OPENSSL_realloc_array(ret, nmemb, td->size);
+ /* clang-format on*/
} else {
if (clear)
+ /* clang-format off */
ln = OPENSSL_LINE, ret = OPENSSL_clear_realloc(ret, old_sz, sz);
+ /* clang-format on */
else
+ /* clang-format off */
ln = OPENSSL_LINE, ret = OPENSSL_realloc(ret, sz);
+ /* clang-format on */
}
} else {
if (array) {
@@ -647,9 +671,14 @@ static int test_xaligned_alloc(const bool array, const bool macro,
if (macro) {
if (array) {
+ /* clang-format off */
ln = OPENSSL_LINE, ret = OPENSSL_aligned_alloc_array(td->nmemb, td->size, td->align, &freeptr);
+ /* clang-format on */
+
} else {
+ /* clang-format off */
ln = OPENSSL_LINE, ret = OPENSSL_aligned_alloc(sz, td->align, &freeptr);
+ /* clang-format on */
}
} else {
if (array)