From 5bdd5f2fd63c53d85e658a23fb530fe3f3fb7a6a Mon Sep 17 00:00:00 2001 From: Bob Beck Date: Fri, 28 Nov 2025 11:20:53 -0700 Subject: [PATCH] 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: Neil Horman Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/29243) --- test/mem_alloc_test.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/test/mem_alloc_test.c b/test/mem_alloc_test.c index 0f305d27440..53391007755 100644 --- a/test/mem_alloc_test.c +++ b/test/mem_alloc_test.c @@ -440,26 +440,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 { @@ -556,14 +572,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) { @@ -654,9 +678,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) -- 2.47.3