diff --git a/swiftmpistepsim.c b/swiftmpistepsim.c
index 7a8091fd909f0a0512900611766f77ceb09ae454..2c22de58452094ecef9b926f94fd41579708bc52 100644
--- a/swiftmpistepsim.c
+++ b/swiftmpistepsim.c
@@ -130,6 +130,7 @@ static void *inject_thread(void *arg) {
     /* Differences to SWIFT: MPI_BYTE not the MPI_Type. */
     int err = 0;
     if (log->type == task_type_send) {
+      log->data = calloc(log->size, 1);
       err = MPI_Isend(log->data, log->size, MPI_BYTE, log->otherrank, log->tag,
                       subtypeMPI_comms[log->subtype], &log->req);
 
@@ -139,6 +140,7 @@ static void *inject_thread(void *arg) {
       atomic_inc(&todo_send);
 
     } else {
+      log->data = calloc(log->size, 1);
       err = MPI_Irecv(log->data, log->size, MPI_BYTE, log->otherrank, log->tag,
                       subtypeMPI_comms[log->subtype], &log->req);
 
@@ -328,7 +330,7 @@ static void pick_logs(void) {
       nlogs, sizeof(struct mpiuse_log_entry *));
   nr_reqs = 0;
   sends_queue = (struct mpiuse_log_entry **)calloc(
-      nlogs, sizeof(struct mpiuse_log_entry *) * nlogs);
+      nlogs, sizeof(struct mpiuse_log_entry *));
   nr_sends = 0;
   recvs_queue = (struct mpiuse_log_entry **)calloc(
       nlogs, sizeof(struct mpiuse_log_entry *));
@@ -346,6 +348,7 @@ static void pick_logs(void) {
         log->data = calloc(log->size, 1);
 
         /* And keep this log. */
+        log->data = NULL;
         reqs_queue[nr_reqs] = log;
         nr_reqs++;