diff --git a/src/output/ods/samplesheet.cpp b/src/output/ods/samplesheet.cpp
index 5a579ef90de84a13f12e78fe8b78109b9f77a41c..a3c78b2a6b07ad7bad8f2635782a0a113af224f5 100644
--- a/src/output/ods/samplesheet.cpp
+++ b/src/output/ods/samplesheet.cpp
@@ -30,7 +30,8 @@
 
 #include "samplesheet.h"
 
-SampleSheet::SampleSheet(OdsExport *p_ods_export, CalcWriterInterface *p_writer,
+SampleSheet::SampleSheet(OdsExport *p_ods_export,
+                         CalcWriterInterface *p_writer,
                          const Project *p_project)
   : _p_project(p_project)
 {
@@ -118,16 +119,19 @@ SampleSheet::writeHeaders()
         "total number of MS level 3 during the MS run (from mz file)");
       _p_writer->writeCell("Total MS3");
 
-      _p_writer->setCellAnnotation("total ion current in MS level 1 spectra "
-                                   "during the MS run (from mz file)");
+      _p_writer->setCellAnnotation(
+        "total ion current in MS level 1 spectra "
+        "during the MS run (from mz file)");
       _p_writer->writeCell("TIC MS1");
 
-      _p_writer->setCellAnnotation("total ion current in MS level 2 spectra "
-                                   "during the MS run (from mz file)");
+      _p_writer->setCellAnnotation(
+        "total ion current in MS level 2 spectra "
+        "during the MS run (from mz file)");
       _p_writer->writeCell("TIC MS2");
 
-      _p_writer->setCellAnnotation("total ion current in MS level 3 spectra "
-                                   "during the MS run (from mz file)");
+      _p_writer->setCellAnnotation(
+        "total ion current in MS level 3 spectra "
+        "during the MS run (from mz file)");
       _p_writer->writeCell("TIC MS3");
     }
 
@@ -148,7 +152,10 @@ SampleSheet::writeIdentificationDataSource(
   if(_msrun_statistics)
     {
       if(msrun_sp->findMsRunFile())
-        msrun_sp->checkMsRunStatistics();
+        {
+          msrun_sp->checkMsRunStatistics();
+        }
+      msrun_sp->freeMsRunReaderSp();
     }
 
   _p_writer->writeCell(msrun_sp.get()->getXmlId());