diff --git a/tests/testParallelMpiWaitany.c b/tests/testParallelMpiWaitany.c
index 51a9d4a8ed5ee302f8c40a72a782ca9501701320..7ae393c2405cef3100948f8b335af1b2d1da341f 100644
--- a/tests/testParallelMpiWaitany.c
+++ b/tests/testParallelMpiWaitany.c
@@ -45,9 +45,6 @@ void *thread_func(void *data_in) {
 }
 
 int main(int argc, char **argv) {
-  // Number of threads per rank.
-  const int num_threads_per_rank = 10;
-
   // Initialize the MPI environment.
   MPI_Init(NULL, NULL);
 
@@ -106,6 +103,10 @@ int main(int argc, char **argv) {
   // Just to be sure, make sure the sends are all done.
   MPI_Waitall(num_ranks, requests_out, MPI_STATUSES_IGNORE);
 
+  // Clean up allocated memory.
+  free(data_in);
+  free(data_out);
+
   // Finalize the MPI environment.
   MPI_Finalize();
   printf("Rank %02i is done.\n", rank);