git: 2561c468c113 - main - Assign and test `malloc` result separately
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 06 Sep 2026 19:18:59 UTC
The branch main has been updated by ngie:
URL: https://cgit.FreeBSD.org/src/commit/?id=2561c468c11309fbc0a097d3f4fcf0bd3bf28b8f
commit 2561c468c11309fbc0a097d3f4fcf0bd3bf28b8f
Author: Enji Cooper <ngie@FreeBSD.org>
AuthorDate: 2026-08-19 08:38:46 +0000
Commit: Enji Cooper <ngie@FreeBSD.org>
CommitDate: 2026-09-06 19:18:24 +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
---
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++) {