tests: Get rid of malloc calls in test_glibc_thread_support.c.
authorRobin Hack <hack.robin@gmail.com>
Fri, 26 Sep 2014 12:31:39 +0000 (14:31 +0200)
committerAndreas Schneider <asn@samba.org>
Mon, 6 Oct 2014 14:16:00 +0000 (16:16 +0200)
Thread structures are allocated on stack now.

Signed-off-by: Robin Hack <hack.robin@gmail.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
tests/test_glibc_thread_support.c

index 357862e5e4c2decc08ca1dfa6b51b08af3d95882..5f1b11da3e8771cc674b4bb4bc3df51e814458a9 100644 (file)
@@ -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);
 }