Removing memory leak
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 27 Jun 2005 07:34:52 +0000 (07:34 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 27 Jun 2005 07:34:52 +0000 (07:34 +0000)
FMD/AliFMDReconstructor.cxx

index 2c61466..88949f2 100644 (file)
@@ -235,11 +235,11 @@ AliFMDReconstructor::Reconstruct(TTree* digitsTree,
   AliDebug(1, "Reconstructing from digits in a tree");
   
   TBranch *digitBranch = digitsTree->GetBranch("FMD");
-  TClonesArray* digits = new TClonesArray("AliFMDDigit");
   if (!digitBranch) {
     Error("Exec", "No digit branch for the FMD found");
     return;
   }
+  TClonesArray* digits = new TClonesArray("AliFMDDigit");
   digitBranch->SetAddress(&digits);
 
   TIter next(&fAlgorithms);
@@ -255,6 +255,8 @@ AliFMDReconstructor::Reconstruct(TTree* digitsTree,
   while ((algorithm = static_cast<AliFMDMultAlgorithm*>(next()))) 
     algorithm->PostEvent();
   clusterTree->Fill();
+  digits->Delete();
+  delete digits;
 }
  
 //____________________________________________________________________