Fixing memory leaks
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 16 Jan 2004 17:06:01 +0000 (17:06 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 16 Jan 2004 17:06:01 +0000 (17:06 +0000)
ITS/AliITStrackerV2.cxx
ITS/AliV0vertexer.cxx

index 33ca6f7..f265486 100644 (file)
@@ -197,7 +197,10 @@ Int_t AliITStrackerV2::Clusters2Tracks(AliESD *event) {
         delete t;
         continue;
       }
-      if (TMath::Abs(t->GetD())>4) continue;
+      if (TMath::Abs(t->GetD())>4) {
+       delete t;
+       continue;
+      }
 
       if (CorrectForDeadZoneMaterial(t)!=0) {
          Warning("Clusters2Tracks",
@@ -284,11 +287,15 @@ Int_t AliITStrackerV2::Clusters2Tracks(TTree *tpcTree, TTree *itsTree) {
            delete t;
            continue;
        }
-       if (TMath::Abs(t->GetD())>4) continue;
+       if (TMath::Abs(t->GetD())>4) {
+        delete t;
+        continue;
+       }
 
        if (CorrectForDeadZoneMaterial(t)!=0) {
         Warning("Clusters2Tracks",
                  "failed to correct for the material in the dead zone !\n");
+        delete t;
          continue;
        }
 
index 120a926..42961a9 100644 (file)
@@ -54,8 +54,14 @@ Int_t AliV0vertexer::Tracks2V0vertices(AliESD *event) {
      AliITStrackV2 *iotrack=new AliITStrackV2(*esd);
      iotrack->SetLabel(i);  // now it is the index in array of ESD tracks
      if ((status&AliESDtrack::kITSrefit)==0)   //correction for the beam pipe
-        if (!iotrack->PropagateTo(3.,0.0023,65.19)) continue;
-     if (!iotrack->PropagateTo(2.5,0.,0.)) continue;
+        if (!iotrack->PropagateTo(3.,0.0023,65.19)) {
+         delete iotrack;
+         continue;
+       }
+     if (!iotrack->PropagateTo(2.5,0.,0.)) {
+       delete iotrack;
+       continue;
+     }
 
      if (iotrack->Get1Pt() > 0.) {nneg++; negtrks.AddLast(iotrack);}
      else {npos++; postrks.AddLast(iotrack);}
@@ -146,8 +152,14 @@ Int_t AliV0vertexer::Tracks2V0vertices(TTree *tTree, TTree *vTree) {
        branch->SetAddress(&iotrack);
        tTree->GetEvent(i);
 
-       if (!iotrack->PropagateTo(3.,0.0023,65.19)) continue; 
-       if (!iotrack->PropagateTo(2.5,0.,0.)) continue;
+       if (!iotrack->PropagateTo(3.,0.0023,65.19)) {
+        delete iotrack;
+        continue; 
+       }
+       if (!iotrack->PropagateTo(2.5,0.,0.)) {
+        delete iotrack;
+        continue;
+       }
 
        if (iotrack->Get1Pt() > 0.) {nneg++; negtrks.AddLast(iotrack);}
        else {npos++; postrks.AddLast(iotrack);}