git: f3cdf3d5dda3 - stable/14 - Assign and test `malloc` result separately
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 22 Sep 2026 06:50:49 UTC
The branch stable/14 has been updated by ngie:
URL: https://cgit.FreeBSD.org/src/commit/?id=f3cdf3d5dda325c30786d444dbd85b7436dec033
commit f3cdf3d5dda325c30786d444dbd85b7436dec033
Author: Enji Cooper <ngie@FreeBSD.org>
AuthorDate: 2026-08-19 08:38:46 +0000
Commit: Enji Cooper <ngie@FreeBSD.org>
CommitDate: 2026-09-22 06:48:36 +0000
Assign and test `malloc` result separately
The previous pattern is cited as an issue with ATF 0.22+ when using
clang/gcc after [1].
MFC after: 2 weeks
Reported by: clang (-Wparenthesis)
Differential Revision: https://reviews.freebsd.org/D59274
[1]: https://github.com/freebsd/atf/pull/72
(cherry picked from commit 2561c468c11309fbc0a097d3f4fcf0bd3bf28b8f)
---
lib/libc/tests/stdlib/qsort_bench.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/libc/tests/stdlib/qsort_bench.c b/lib/libc/tests/stdlib/qsort_bench.c
index 5f2cfae40140..285877c6c212 100644
--- a/lib/libc/tests/stdlib/qsort_bench.c
+++ b/lib/libc/tests/stdlib/qsort_bench.c
@@ -53,7 +53,7 @@ qsort_bench(int log2n)
int *buf;
/* fill an array with a pathological pattern */
- ATF_REQUIRE(buf = malloc(n * sizeof(*buf)));
+ ATF_REQUIRE((buf = malloc(n * sizeof(*buf))) != NULL);
buf[0] = 0;
buf[n / 2] = n / 2;
for (unsigned int i = 1; i < n / 2; i++) {