From 70d08ba2046f4e589fdfa0f35999dfd413844bef Mon Sep 17 00:00:00 2001 From: Siddhesh Poyarekar Date: Wed, 28 Jul 2021 13:03:27 +0530 Subject: tests: use xmalloc to allocate implementation array The benchmark and tests must fail in case of allocation failure in the implementation array. Also annotate the x* allocators in support.h so that the compiler has more information about them. Reviewed-by: Florian Weimer --- string/test-string.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'string') diff --git a/string/test-string.h b/string/test-string.h index febde61040..78b66efe36 100644 --- a/string/test-string.h +++ b/string/test-string.h @@ -18,6 +18,7 @@ . */ #include +#include typedef struct { @@ -146,8 +147,8 @@ static impl_t *impl_array; skip = impl; \ else \ impl_count++; \ - a = impl_array = malloc ((impl_count + func_count) * \ - sizeof (impl_t)); \ + a = impl_array = xmalloc ((impl_count + func_count) * \ + sizeof (impl_t)); \ for (impl = __start_impls; impl < __stop_impls; ++impl) \ if (impl != skip) \ *a++ = *impl; \ -- cgit 1.4.1