diff --git a/logger/logger_header.c b/logger/logger_header.c
index d1c70736d4f895c4ec58e7a625a4c10c6597d281..8b8f3c9626caa2a69c3772f12b2a31ef5a455659 100644
--- a/logger/logger_header.c
+++ b/logger/logger_header.c
@@ -154,6 +154,9 @@ void header_read(struct header *h, struct logger_logfile *log) {
 
   /* Allocate the masks memory. */
   h->masks = malloc(sizeof(struct mask_data) * h->masks_count);
+  if (h->masks == NULL) {
+    error("Failed to allocate the memory for the masks.");
+  }
 
   /* Loop over all masks. */
   h->timestamp_mask = 0;
diff --git a/src/logger_io.c b/src/logger_io.c
index 06e7d0131451fdcb106d5c763465761ecee2bbc5..e227db3b169767ad4a88514d136a9593b476b64d 100644
--- a/src/logger_io.c
+++ b/src/logger_io.c
@@ -217,7 +217,7 @@ void logger_write_index_file(struct logger_writer* log, struct engine* e) {
   size_t cur_pos = ftell(f);
   size_t d_align = ((cur_pos + 7) & ~7) - cur_pos;
   if (d_align > 0) {
-    int tmp = 0;
+    long int tmp = 0;
     /* Fill the memory with garbage */
     fwrite(&tmp, d_align, 1, f);
   }