Fixing memory leak (delete[] fImage)
authorshahoian <shahoian@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 25 Oct 2011 15:55:20 +0000 (15:55 +0000)
committershahoian <shahoian@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 25 Oct 2011 15:55:20 +0000 (15:55 +0000)
STEER/STEER/AliQACheckerBase.cxx

index 270f77e..cd55c99 100644 (file)
@@ -132,6 +132,7 @@ AliQACheckerBase::~AliQACheckerBase()
   delete [] fLowTestValue ; 
   delete [] fUpTestValue ; 
   DeleteImages();  
+  delete[] fImage ; 
   delete[] fRefOCDBSubDir ; 
   AliQAv1::GetQAResultFile()->Close() ; 
   if (fExternParamList) {
@@ -245,13 +246,11 @@ void AliQACheckerBase::Check(Double_t * test, AliQAv1::ALITASK_t task, TObjArray
 //____________________________________________________________________________ 
 void AliQACheckerBase::DeleteImages()
 {
-    for (Int_t esIndex = 0 ; esIndex < AliRecoParam::kNSpecies ; esIndex++) {
-        if ( fImage[esIndex] ) 
-            delete fImage[esIndex] ;
-        if ( fRefOCDBSubDir[esIndex] ) 
-            delete fRefOCDBSubDir[esIndex] ; 
-    }
-    // delete[] fImage ; 
+  // clean images
+  for (Int_t esIndex = 0 ; esIndex < AliRecoParam::kNSpecies ; esIndex++) {
+    if ( fImage[esIndex] )          {delete fImage[esIndex];          fImage[esIndex] = 0;}
+    if ( fRefOCDBSubDir[esIndex] )  {delete fRefOCDBSubDir[esIndex];  fRefOCDBSubDir[esIndex] = 0;}
+  }
 }
 
 //____________________________________________________________________________