1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-08-07 06:43:00 +03:00

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 <fweimer@redhat.com>
This commit is contained in:
Siddhesh Poyarekar
2021-07-28 13:03:27 +05:30
parent b8e8bb324a
commit 70d08ba204
3 changed files with 23 additions and 11 deletions

View File

@@ -18,6 +18,7 @@
<https://www.gnu.org/licenses/>. */
#include <sys/cdefs.h>
#include <support/support.h>
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; \