From a8d0bc7279a44141477f508dcde177bee57957a7 Mon Sep 17 00:00:00 2001 From: Robin Hack Date: Fri, 26 Sep 2014 14:31:39 +0200 Subject: [PATCH] tests: Get rid of malloc calls in test_glibc_thread_support.c. Thread structures are allocated on stack now. Signed-off-by: Robin Hack Reviewed-by: Andreas Schneider Reviewed-by: Stefan Metzmacher --- tests/test_glibc_thread_support.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/tests/test_glibc_thread_support.c b/tests/test_glibc_thread_support.c index 357862e..5f1b11d 100644 --- a/tests/test_glibc_thread_support.c +++ b/tests/test_glibc_thread_support.c @@ -47,14 +47,11 @@ static void *syscall_setreuid(void *arg) static void test_syscall_setreuid(void **state) { pthread_attr_t pthread_custom_attr; - pthread_t *threads; + pthread_t threads[NUM_THREADS]; int i; (void) state; /* unused */ - threads = (pthread_t*)malloc(NUM_THREADS * sizeof(pthread_t)); - assert_non_null(threads); - pthread_attr_init(&pthread_custom_attr); for (i = 0; i < NUM_THREADS; i++) { @@ -67,8 +64,6 @@ static void test_syscall_setreuid(void **state) for (i = 0; i < NUM_THREADS; i++) { pthread_join(threads[i], NULL); } - - free(threads); } static void *sync_setreuid(void *arg) @@ -93,15 +88,13 @@ static void *sync_setreuid(void *arg) static void test_sync_setreuid(void **state) { pthread_attr_t pthread_custom_attr; - pthread_t *threads; + pthread_t threads[NUM_THREADS]; struct parm *p; int rc; int i; (void) state; /* unused */ - threads = (pthread_t*)malloc(NUM_THREADS * sizeof(pthread_t)); - assert_non_null(threads); pthread_attr_init(&pthread_custom_attr); p = malloc(NUM_THREADS * sizeof(struct parm)); @@ -135,7 +128,6 @@ static void test_sync_setreuid(void **state) pthread_join(threads[i], NULL); } - free(threads); free(p); } -- 2.34.1