]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - RAW/AliMDC.cxx
Fix Coverity
[u/mrichter/AliRoot.git] / RAW / AliMDC.cxx
index a4374b53c02129aedc183390791be61a8f19951a..869948a78e2b3b99950f64151dbf338de0d3c789 100644 (file)
@@ -509,8 +509,10 @@ Int_t AliMDC::Run(const char* inputFile, Bool_t loop,
   // Create new raw DB.
   if (fRawDB) Close();
 
-  if (Open(mode,NULL,maxFileSize,fs1,fs2) < 0) return 1;
-
+  if (Open(mode,NULL,maxFileSize,fs1,fs2) < 0) {
+    if (fd>-1) close(fd);
+    return 1;
+  }
   // Process input stream
 #ifdef USE_EB
   Int_t eorFlag = 0;
@@ -565,6 +567,7 @@ Int_t AliMDC::Run(const char* inputFile, Bool_t loop,
            Error("Run", "error reading base header");
            Close();
            delete[] event;
+           if (fd>-1) close(fd);
            return 1;
          }
        }
@@ -593,6 +596,7 @@ Int_t AliMDC::Run(const char* inputFile, Bool_t loop,
          Close();
          delete[] event;
          delete hdr;
+         if (fd>-1) close(fd);
          return 1;
        }
       }
@@ -612,6 +616,7 @@ Int_t AliMDC::Run(const char* inputFile, Bool_t loop,
        Close();
        delete[] event;
        delete hdr;
+       if (fd>-1) close(fd);
        return 1;
       }
     }
@@ -642,6 +647,7 @@ Int_t AliMDC::Run(const char* inputFile, Bool_t loop,
          Close();
          if (inputFile) delete[] event;
          delete hdr;
+         if (fd>-1) close(fd);
          return 1;
        }
 
@@ -694,7 +700,7 @@ Int_t AliMDC::Run(const char* inputFile, Bool_t loop,
 #endif
   } else {
     // Close input source
-    close(fd);
+    if (fd>-1) close(fd);
     delete [] event;
   }