diff --git a/swiftmpistepsim.c b/swiftmpistepsim.c index 68bef3b09674c7665000c2f10152b673ccc2af85..394dea04b506074c75fa76e037bb283e12b8dc59 100644 --- a/swiftmpistepsim.c +++ b/swiftmpistepsim.c @@ -321,14 +321,14 @@ static void pick_logs(void) { size_t nlogs = mpiuse_nr_logs(); /* Duplicate of logs. */ - reqs_queue = (struct mpiuse_log_entry **)malloc( - sizeof(struct mpiuse_log_entry *) * nlogs); + reqs_queue = (struct mpiuse_log_entry **)calloc( + nlogs, sizeof(struct mpiuse_log_entry *)); nr_reqs = 0; - sends_queue = (struct mpiuse_log_entry **)malloc( - sizeof(struct mpiuse_log_entry *) * nlogs); + sends_queue = (struct mpiuse_log_entry **)calloc( + nlogs, sizeof(struct mpiuse_log_entry *) * nlogs); nr_sends = 0; - recvs_queue = (struct mpiuse_log_entry **)malloc( - sizeof(struct mpiuse_log_entry *) * nlogs); + recvs_queue = (struct mpiuse_log_entry **)calloc( + nlogs, sizeof(struct mpiuse_log_entry *)); nr_recvs = 0; for (int k = 0; k < nlogs; k++) { @@ -354,8 +354,9 @@ static void pick_logs(void) { /* Check. */ for (int k = 0; k < nr_reqs - 1; k++) { - if (reqs_queue[k]->tic > reqs_queue[k+1]->tic) - message("reqs_queue: %lld > %lld", reqs_queue[k]->tic, reqs_queue[k+1]->tic); + if (reqs_queue[k]->tic > reqs_queue[k + 1]->tic) + message("reqs_queue: %lld > %lld", reqs_queue[k]->tic, + reqs_queue[k + 1]->tic); } }