coverity fix
authorjotwinow <jotwinow@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 29 Mar 2012 09:03:53 +0000 (09:03 +0000)
committerjotwinow <jotwinow@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 29 Mar 2012 09:03:53 +0000 (09:03 +0000)
PWGLF/SPECTRA/ChargedHadrons/dNdPt/AlidNdPtAnalysis.cxx

index 2ace1de..2cd82e5 100644 (file)
@@ -1356,9 +1356,9 @@ void AlidNdPtAnalysis::Process(AliESDEvent *const esdEvent, AliMCEvent *const mc
 \r
        // replace esd track parameters with TPCinner\r
         AliExternalTrackParam  *tpcTrack  = new AliExternalTrackParam(*(track->GetTPCInnerParam()));\r
-       if (!tpcTrack) return;\r
-        track->Set(tpcTrack->GetX(),tpcTrack->GetAlpha(),tpcTrack->GetParameter(),tpcTrack->GetCovariance());\r
-\r
+       if (tpcTrack) {\r
+          track->Set(tpcTrack->GetX(),tpcTrack->GetAlpha(),tpcTrack->GetParameter(),tpcTrack->GetCovariance());\r
+        }\r
         if(tpcTrack) delete tpcTrack; \r
       } \r
 \r
@@ -1407,7 +1407,7 @@ void AlidNdPtAnalysis::Process(AliESDEvent *const esdEvent, AliMCEvent *const mc
 \r
    if(IsUseMCInfo())  \r
    {\r
-     if(!mcEvent) return; \r
+     if(mcEvent) {\r
 \r
      if(evtCuts->IsEventSelectedRequired()) \r
      { \r
@@ -1417,7 +1417,15 @@ void AlidNdPtAnalysis::Process(AliESDEvent *const esdEvent, AliMCEvent *const mc
 \r
        Bool_t isMCEventSelected = AlidNdPtHelper::SelectMCEvent(mcEvent);\r
        //printf("isMCEventSelected %d \n", isMCEventSelected);\r
-       if(!isMCEventSelected) return;  \r
+       if(!isMCEventSelected) { \r
+\r
+        if(allChargedTracks) delete allChargedTracks; allChargedTracks = 0;\r
+        if(labelsAll) delete [] labelsAll; labelsAll = 0;\r
+        if(labelsAcc) delete [] labelsAcc; labelsAcc = 0;\r
+        if(labelsRec) delete [] labelsRec; labelsRec = 0;\r
+\r
+        return;  \r
+       }\r
      }\r
 \r
      Double_t vMultTrueEventMatrix[3] = { multRec, multMCTrueTracks, multMBTracks};\r
@@ -1658,10 +1666,9 @@ void AlidNdPtAnalysis::Process(AliESDEvent *const esdEvent, AliMCEvent *const mc
        }\r
 \r
        if(countRecCandle>0) fRecCandleEventMatrix->Fill(vEventMatrix);\r
-     }\r
-\r
-\r
-   } // end bUseMC\r
+      }\r
+    }\r
+  }// end bUseMC\r
 \r
   if(allChargedTracks) delete allChargedTracks; allChargedTracks = 0;\r
   if(labelsAll) delete [] labelsAll; labelsAll = 0;\r