diff --git a/src/common_io.c b/src/common_io.c
index 6cce7e21aa9d0eb0e8841050e4b5f6d612417a12..e6c0d016f4651e08a745ab0d399c6205c1f68415 100644
--- a/src/common_io.c
+++ b/src/common_io.c
@@ -399,19 +399,19 @@ void io_write_cell_offsets(hid_t h_grp, const int cdim[3],
 
   /* Temporary memory for the cell-by-cell information */
   double* centres = NULL;
-  centres = malloc(3 * nr_cells * sizeof(double));
+  centres = (double*)malloc(3 * nr_cells * sizeof(double));
 
   /* Count of particles in each cell */
   long long *count_part = NULL, *count_gpart = NULL, *count_spart = NULL;
-  count_part = malloc(nr_cells * sizeof(long long));
-  count_gpart = malloc(nr_cells * sizeof(long long));
-  count_spart = malloc(nr_cells * sizeof(long long));
+  count_part = (long long*)malloc(nr_cells * sizeof(long long));
+  count_gpart = (long long*)malloc(nr_cells * sizeof(long long));
+  count_spart = (long long*)malloc(nr_cells * sizeof(long long));
 
   /* Global offsets of particles in each cell */
   long long *offset_part = NULL, *offset_gpart = NULL, *offset_spart = NULL;
-  offset_part = malloc(nr_cells * sizeof(long long));
-  offset_gpart = malloc(nr_cells * sizeof(long long));
-  offset_spart = malloc(nr_cells * sizeof(long long));
+  offset_part = (long long*)malloc(nr_cells * sizeof(long long));
+  offset_gpart = (long long*)malloc(nr_cells * sizeof(long long));
+  offset_spart = (long long*)malloc(nr_cells * sizeof(long long));
 
   /* Offsets of the 0^th element */
   offset_part[0] = 0;
diff --git a/src/parallel_io.c b/src/parallel_io.c
index b62422d22fb099e0b4da31a0bd1063b952268575..0c6514b6b4765aab5fd3c8cd6aa7132707957cb4 100644
--- a/src/parallel_io.c
+++ b/src/parallel_io.c
@@ -984,7 +984,8 @@ void prepare_file(struct engine* e, const char* baseName, long long N_total[6],
 
   /* Open header to write simulation properties */
   /* message("Writing file header..."); */
-  h_grp = H5Gcreate(h_file, "/Header", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+  hid_t h_grp =
+      H5Gcreate(h_file, "/Header", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
   if (h_grp < 0) error("Error while creating file header\n");
 
   /* Convert basic output information to snapshot units */