aio-stress: use calloc for thread_info array
authorJeff Mahoney <jeffm@suse.com>
Mon, 20 Jan 2014 02:28:27 +0000 (13:28 +1100)
committerDave Chinner <david@fromorbit.com>
Mon, 20 Jan 2014 02:28:27 +0000 (13:28 +1100)
The thread_info array is assumed to be initialized to 0s, but
that causes a segfault when MALLOC_PERTURB_ is set.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <dchinner@redhat.com>
ltp/aio-stress.c

index ebff1bd42a92e51cdd0de72e2419b840e91b19f2..d08843a8a2f84f15f24a964bc9ae09adadf2ac31 100644 (file)
@@ -1413,9 +1413,9 @@ int main(int ac, char **av)
                num_threads);
     }
 
-    t = malloc(num_threads * sizeof(*t));
+    t = calloc(num_threads, sizeof(*t));
     if (!t) {
-        perror("malloc");
+        perror("calloc");
        exit(1);
     }
     global_thread_info = t;