]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Fix for coverity, potential mem leak
authorslindal <slindal@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 20 Feb 2011 13:32:16 +0000 (13:32 +0000)
committerslindal <slindal@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 20 Feb 2011 13:32:16 +0000 (13:32 +0000)
HLT/EVE/AliHLTEveCalo.cxx
HLT/EVE/AliHLTEveCalo.h

index f1f539f45a25f128aba7e43e2a2cfca1e37f240a..2d2175550a30c7145e87d1e361d4a83dacbd95bf 100644 (file)
@@ -50,7 +50,8 @@ AliHLTEveCalo::AliHLTEveCalo(Int_t nm, TString name) :
   fClustersArray(NULL),
   fName(name), 
   fPadTitles(NULL),
-  fInvMassCanvas(NULL)
+  fInvMassCanvas(NULL),
+  fClusterReader(NULL)
 {
   // Constructor.
 
@@ -63,6 +64,10 @@ AliHLTEveCalo::AliHLTEveCalo(Int_t nm, TString name) :
   }
 
   fClustersArray = new TRefArray();
+  fClusterReader = new AliHLTCaloClusterReader();
+
+
+
 
 }
 
@@ -82,6 +87,11 @@ AliHLTEveCalo::~AliHLTEveCalo()
     delete [] fPadTitles;
   fPadTitles = NULL;
 
+
+  if(fClusterReader)
+    delete fClusterReader;
+  fClusterReader = NULL;
+
 }
 
 
@@ -175,17 +185,16 @@ void AliHLTEveCalo::ProcessClusters(AliHLTHOMERBlockDesc* block) {
   //See header file for documentation
 
   AliHLTCaloClusterHeaderStruct *dh = reinterpret_cast<AliHLTCaloClusterHeaderStruct*> (block->GetData());
-  AliHLTCaloClusterReader * clusterReader = new AliHLTCaloClusterReader();
-  clusterReader->SetMemory(dh);  
+  fClusterReader->SetMemory(dh);  
 
   AliHLTCaloClusterDataStruct * ds;
 
-  while( (ds = clusterReader->NextCluster()) ){
+  while( (ds = fClusterReader->NextCluster()) ){
      AddClusters(ds->fGlobalPos, ds->fModule, ds->fEnergy);
   }
 
-  AliHLTCaloDigitDataStruct *dg = clusterReader->GetDigits();
-  UInt_t nDigits = clusterReader->GetNDigits();;
+  AliHLTCaloDigitDataStruct *dg = fClusterReader->GetDigits();
+  UInt_t nDigits = fClusterReader->GetNDigits();;
   for(UInt_t i = 0; i < nDigits; i++, dg++) {
     AddDigits(dg->fX, dg->fZ, dg->fModule, dg->fEnergy);
   }
index ae911703df84047bdd019e6619ef413fa8e15a95..ca82656daf13ab595f7c4ef778e88c423e27e09c 100644 (file)
@@ -13,6 +13,7 @@
 #include "AliHLTEveBase.h"
 #include "TString.h"
 
+class AliHLTCaloClusterReader;
 class AliESDEvent;
 class AliESDCaloCluster;
 class TRefArray;
@@ -102,11 +103,9 @@ private:
   void DrawInvMassHistogram(TH1F * histo);
 
   TString fName;  //PHOS or EMCAL
   TString * fPadTitles;
-
-
   TCanvas * fInvMassCanvas;
+  AliHLTCaloClusterReader * fClusterReader;
 
 
   ClassDef(AliHLTEveCalo, 0);