Fix tests: use of uninitialized variables
[userspace-rcu.git] / tests / test_urcu_hash.c
index 5710de08135f8e0f58be45bfec59cca94636031e..d5df1eb8ee352d872782867d4932d674bfde7123 100644 (file)
@@ -201,7 +201,8 @@ unsigned long test_compare(const void *key1, size_t key1_len,
 void *thr_count(void *arg)
 {
        printf_verbose("thread_begin %s, thread id : %lx, tid %lu\n",
-                       "counter", pthread_self(), (unsigned long)gettid());
+                       "counter", (unsigned long) pthread_self(),
+                       (unsigned long) gettid());
 
        rcu_register_thread();
 
@@ -536,12 +537,13 @@ int main(int argc, char **argv)
        printf_verbose("Number of hash chains: %lu.\n",
                nr_hash_chains);
        printf_verbose("thread %-6s, thread id : %lx, tid %lu\n",
-                       "main", pthread_self(), (unsigned long)gettid());
+                       "main", (unsigned long) pthread_self(),
+                       (unsigned long) gettid());
 
-       tid_reader = malloc(sizeof(*tid_reader) * nr_readers);
-       tid_writer = malloc(sizeof(*tid_writer) * nr_writers);
-       count_reader = malloc(sizeof(*count_reader) * nr_readers);
-       count_writer = malloc(sizeof(*count_writer) * nr_writers);
+       tid_reader = calloc(nr_readers, sizeof(*tid_reader));
+       tid_writer = calloc(nr_writers, sizeof(*tid_writer));
+       count_reader = calloc(nr_readers, sizeof(*count_reader));
+       count_writer = calloc(nr_writers, sizeof(*count_writer));
 
        err = create_all_cpu_call_rcu_data(0);
        if (err) {
This page took 0.023366 seconds and 4 git commands to generate.