From 234f6d32609eb9caac313644e7c44f6dcf3fe1b7 Mon Sep 17 00:00:00 2001 From: hristov Date: Sat, 22 Apr 2006 08:15:55 +0000 Subject: [PATCH] Fixing memory leak (L.Gaudichet) --- PYTHIA6/AliGenPythia.cxx | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/PYTHIA6/AliGenPythia.cxx b/PYTHIA6/AliGenPythia.cxx index d60a161704c..07ababc67a9 100644 --- a/PYTHIA6/AliGenPythia.cxx +++ b/PYTHIA6/AliGenPythia.cxx @@ -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