]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Fixing memory leak (L.Gaudichet)
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 22 Apr 2006 08:15:55 +0000 (08:15 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 22 Apr 2006 08:15:55 +0000 (08:15 +0000)
PYTHIA6/AliGenPythia.cxx

index d60a161704caa863979ce88d269350cd39902272..07ababc67a91fb2cd3dc7268163ec63a3be86646 100644 (file)
@@ -659,9 +659,9 @@ void AliGenPythia::Generate()
        
        GetSubEventTime();
 
-       if (pParent)   delete[] pParent;
-       if (pSelected) delete[] pSelected;
-       if (trackIt)   delete[] trackIt;
+       delete[] pParent;
+       delete[] pSelected;
+       delete[] trackIt;
 
        if (nc > 0) {
          switch (fCountMode) {
@@ -722,7 +722,10 @@ Int_t  AliGenPythia::GenerateMB()
     if (fProcess == kPyJets || fProcess == kPyDirectGamma) {
        TParticle* jet1 = (TParticle *) fParticles->At(6);
        TParticle* jet2 = (TParticle *) fParticles->At(7);
-       if (!CheckTrigger(jet1, jet2)) return 0;
+       if (!CheckTrigger(jet1, jet2)) {
+         delete [] pParent;
+         return 0;
+       }
     }
 
     if (fTriggerParticle) {
@@ -736,7 +739,10 @@ Int_t  AliGenPythia::GenerateMB()
            triggered = kTRUE;
            break;
        }
-       if (!triggered) return 0;
+       if (!triggered) {
+         delete [] pParent;
+         return 0;
+       }
     }
        
 
@@ -757,7 +763,7 @@ Int_t  AliGenPythia::GenerateMB()
        if(yQ>fYMin && yQ<fYMax) inYcut=kTRUE;
       }
       if (!theQ || !theQbar || !inYcut) {
-       if (pParent) delete[] pParent;
+       delete[] pParent;
        return 0;
       }
     }
@@ -766,7 +772,7 @@ Int_t  AliGenPythia::GenerateMB()
     if ( (fProcess == kPyW || fProcess == kPyZ || fProcess == kPyMb || fProcess == kPyMbNonDiffr)  
         && (fCutOnChild == 1) ) {
       if ( !CheckKinematicsOnChild() ) {
-       if (pParent)   delete[] pParent;
+       delete[] pParent;
        return 0;
       }
     }
@@ -827,7 +833,7 @@ Int_t  AliGenPythia::GenerateMB()
        } // select particle
     } // particle loop 
 
-    if (pParent) delete[] pParent;
+    delete[] pParent;
     
     return 1;
 }