From a987273c99d4a155cdc733a9ab7446ed695a9333 Mon Sep 17 00:00:00 2001 From: cblume Date: Wed, 13 Oct 2010 15:20:17 +0000 Subject: [PATCH] Coverity stuff once more ... --- TRD/AliTRDCalibChamberStatus.cxx | 7 ++++--- TRD/AliTRDCalibTask.cxx | 4 +++- TRD/AliTRDCalibViewer.cxx | 6 +++--- TRD/AliTRDCalibraFit.cxx | 4 ++-- TRD/AliTRDCalibraVdriftLinearFit.cxx | 4 ++-- TRD/AliTRDalignment.cxx | 4 ++++ TRD/AliTRDarrayADC.cxx | 7 +++++++ TRD/AliTRDarrayDictionary.cxx | 7 +++++-- TRD/AliTRDclusterizer.cxx | 9 +++------ TRD/AliTRDdigitsManager.cxx | 4 ++-- TRD/Cal/AliTRDCalDet.cxx | 6 +++--- TRD/Cal/AliTRDCalMonitoring.cxx | 4 ++++ TRD/Cal/AliTRDCalPad.cxx | 4 ++-- TRD/qaAnalysis/AliAnalysisTaskTRDmon.cxx | 1 - TRD/qaAnalysis/AliTRDqaJPsi.cxx | 4 ++++ TRD/qaGui/AliTRDqaGuiBlackSM.cxx | 3 ++- 16 files changed, 50 insertions(+), 28 deletions(-) diff --git a/TRD/AliTRDCalibChamberStatus.cxx b/TRD/AliTRDCalibChamberStatus.cxx index a91ef5588d6..3bb3dc8088e 100644 --- a/TRD/AliTRDCalibChamberStatus.cxx +++ b/TRD/AliTRDCalibChamberStatus.cxx @@ -280,6 +280,7 @@ void AliTRDCalibChamberStatus::ProcessEvent(AliRawReader * rawReader, Int_t neve rawStream->SetSharedPadReadout(kFALSE); AliTRDdigitsManager *digitsManager = new AliTRDdigitsManager(kTRUE); + if (!digitsManager) return; digitsManager->CreateArrays(); Int_t det = 0; @@ -331,8 +332,8 @@ void AliTRDCalibChamberStatus::ProcessEvent(AliRawReader * rawReader, Int_t neve if(notEmpty) fCounterEventNotEmpty++; - if(digitsManager) delete digitsManager; - if(rawStream) delete rawStream; + delete digitsManager; + delete rawStream; }//_____________________________________________________________________ void AliTRDCalibChamberStatus::ProcessEvent3(AliRawReader * rawReader, Int_t nevents_physics) @@ -402,7 +403,7 @@ void AliTRDCalibChamberStatus::ProcessEvent3(AliRawReader * rawReader, Int_t nev if(notEmpty) fCounterEventNotEmpty++; - if(digitsManager) delete digitsManager; + delete digitsManager; delete rawStream; } diff --git a/TRD/AliTRDCalibTask.cxx b/TRD/AliTRDCalibTask.cxx index 79660af9af3..aadec5e5c67 100644 --- a/TRD/AliTRDCalibTask.cxx +++ b/TRD/AliTRDCalibTask.cxx @@ -934,7 +934,9 @@ void AliTRDCalibTask::Plot() first += 1; } else { - histolinearfitsum ->Add(linearfit->GetLinearFitterHisto(det)); + if (histolinearfitsum) { + histolinearfitsum->Add(linearfit->GetLinearFitterHisto(det)); + } } } } diff --git a/TRD/AliTRDCalibViewer.cxx b/TRD/AliTRDCalibViewer.cxx index 17f13a48759..c1eba0b49f1 100644 --- a/TRD/AliTRDCalibViewer.cxx +++ b/TRD/AliTRDCalibViewer.cxx @@ -360,7 +360,7 @@ void AliTRDCalibViewer::GetLayerSectorStack(TString trdString, Int_t& layerNo, I // encoded with the following format: // Layer%dSector%dStack%d - sscanf(trdString.Data(), "Layer%dSector%dStack%d", &layerNo, §orNo, &stackNo); + sscanf(trdString.Data(), "Layer%1dSector%02dStack%1d", &layerNo, §orNo, &stackNo); return; } @@ -636,7 +636,7 @@ Int_t AliTRDCalibViewer::EasyDraw(const char* drawCommand, Int_t chamber, const Int_t stackNo = (chamber%30)/6; Int_t layerNo = (chamber%30)%6; char sectorChr[22]; - sprintf(sectorChr, "Layer%iSector%iStack%i", layerNo, superModuleNo, stackNo); + snprintf(sectorChr,22, "Layer%iSector%iStack%i", layerNo, superModuleNo, stackNo); return EasyDraw(drawCommand, sectorChr, cuts, drawOptions, writeDrawCommand); } Error("EasyDraw","The TRD contains only chamber from 0 to 539"); @@ -659,7 +659,7 @@ Int_t AliTRDCalibViewer::EasyDraw1D(const char* drawCommand, Int_t chamber, cons Int_t stackNo = (chamber%30)/6; Int_t layerNo = (chamber%30)%6; char sectorChr[22]; - sprintf(sectorChr, "Layer%iSector%iStack%i", layerNo, superModuleNo, stackNo); + snprintf(sectorChr,22, "Layer%iSector%iStack%i", layerNo, superModuleNo, stackNo); return EasyDraw1D(drawCommand, sectorChr, cuts, drawOptions, writeDrawCommand); } Error("EasyDraw1D","The TRD contains only chambers from 0 to 539"); diff --git a/TRD/AliTRDCalibraFit.cxx b/TRD/AliTRDCalibraFit.cxx index aa83e6767d5..81f7543bb95 100644 --- a/TRD/AliTRDCalibraFit.cxx +++ b/TRD/AliTRDCalibraFit.cxx @@ -4886,8 +4886,8 @@ void AliTRDCalibraFit::FitLagrangePoly(TH1* projPH) pente->Draw(); } else { - if(pentea) delete pentea; - if(pente) delete pente; + delete pentea; + delete pente; if(polynome) delete polynome; if(polynomea) delete polynomea; if(polynomeb) delete polynomeb; diff --git a/TRD/AliTRDCalibraVdriftLinearFit.cxx b/TRD/AliTRDCalibraVdriftLinearFit.cxx index 80ce619e5a4..4a9c859193b 100644 --- a/TRD/AliTRDCalibraVdriftLinearFit.cxx +++ b/TRD/AliTRDCalibraVdriftLinearFit.cxx @@ -351,8 +351,8 @@ void AliTRDCalibraVdriftLinearFit::FillPEArray() }// if something - delete [] arrayI; - } + + delete [] arrayI; } diff --git a/TRD/AliTRDalignment.cxx b/TRD/AliTRDalignment.cxx index b2bc442c41e..c341f2f1eb0 100644 --- a/TRD/AliTRDalignment.cxx +++ b/TRD/AliTRDalignment.cxx @@ -178,6 +178,10 @@ AliTRDalignment::AliTRDalignment(const AliTRDalignment& source) fSurveyY0[j][k][l] = source.fSurveyY0[j][k][l]; fSurveyZ0[j][k][l] = source.fSurveyZ0[j][k][l]; } + for (int i=0; i<1000; i++) { + fIbuffer[i] = 0; + fDbuffer[i] = 0.0; + } } diff --git a/TRD/AliTRDarrayADC.cxx b/TRD/AliTRDarrayADC.cxx index 4116907d3bd..7f28103a587 100644 --- a/TRD/AliTRDarrayADC.cxx +++ b/TRD/AliTRDarrayADC.cxx @@ -418,8 +418,15 @@ void AliTRDarrayADC::Compress() buffer=0; } + } + + if (longz) + { delete [] longz; longz=0; + } + if (longm) + { delete [] longm; longm=0; diff --git a/TRD/AliTRDarrayDictionary.cxx b/TRD/AliTRDarrayDictionary.cxx index d76dcad7c58..d239fa3f65a 100644 --- a/TRD/AliTRDarrayDictionary.cxx +++ b/TRD/AliTRDarrayDictionary.cxx @@ -375,8 +375,11 @@ void AliTRDarrayDictionary::Expand() } - delete [] longArr; - + } + + if (longArr) + { + delete [] longArr; } } diff --git a/TRD/AliTRDclusterizer.cxx b/TRD/AliTRDclusterizer.cxx index 5c4a8b59eed..de142a4645f 100644 --- a/TRD/AliTRDclusterizer.cxx +++ b/TRD/AliTRDclusterizer.cxx @@ -111,7 +111,9 @@ AliTRDclusterizer::AliTRDclusterizer(const AliTRDReconstructor *const rec) } //_____________________________________________________________________________ -AliTRDclusterizer::AliTRDclusterizer(const Text_t *name, const Text_t *title, const AliTRDReconstructor *const rec) +AliTRDclusterizer::AliTRDclusterizer(const Text_t *name + , const Text_t *title + , const AliTRDReconstructor *const rec) :TNamed(name,title) ,fReconstructor(rec) ,fRunLoader(NULL) @@ -153,11 +155,6 @@ AliTRDclusterizer::AliTRDclusterizer(const Text_t *name, const Text_t *title, co SetBit(kLabels, kTRUE); SetBit(knewDM, kFALSE); - AliTRDcalibDB *trd = 0x0; - if (!(trd = AliTRDcalibDB::Instance())) { - AliFatal("Could not get calibration object"); - } - fDigitsManager->CreateArrays(); fRawVersion = AliTRDfeeParam::Instance()->GetRAWversion(); diff --git a/TRD/AliTRDdigitsManager.cxx b/TRD/AliTRDdigitsManager.cxx index cb38cf35871..048ee250679 100644 --- a/TRD/AliTRDdigitsManager.cxx +++ b/TRD/AliTRDdigitsManager.cxx @@ -878,7 +878,7 @@ Bool_t AliTRDdigitsManager::LoadArrayDict() // Get the branch Char_t branchname[15]; - sprintf(branchname,"TRDdictionary%d",iDict); + snprintf(branchname,15,"TRDdictionary%d",iDict); TBranch *branch = fTree->GetBranch(branchname); if (!branch) { @@ -1013,7 +1013,7 @@ Bool_t AliTRDdigitsManager::StoreArrayDict() // Get the branch Char_t branchname[15]; - sprintf(branchname,"TRDdictionary%d",iDict); + snprintf(branchname,15,"TRDdictionary%d",iDict); TBranch *branch = fTree->GetBranch(branchname); if (!branch) { diff --git a/TRD/Cal/AliTRDCalDet.cxx b/TRD/Cal/AliTRDCalDet.cxx index 2b2bce1e5ae..082181edd18 100644 --- a/TRD/Cal/AliTRDCalDet.cxx +++ b/TRD/Cal/AliTRDCalDet.cxx @@ -279,7 +279,7 @@ TH1F * AliTRDCalDet::MakeHisto1DAsFunctionOfDet(Float_t min, Float_t max,Int_t t } char name[1000]; - sprintf(name,"%s CalDet as function of det",GetTitle()); + snprintf(name,1000,"%s CalDet as function of det",GetTitle()); TH1F * his = new TH1F(name,name,kNdet, 0, kNdet); for(Int_t det = 0; det< kNdet; det++){ his->Fill(det+0.5,GetValue(det)); @@ -334,7 +334,7 @@ TH2F *AliTRDCalDet::MakeHisto2DCh(Int_t ch, Float_t min, Float_t max, Int_t type Double_t posglobal[3] = {0.0,0.0,0.0}; char name[1000]; - sprintf(name,"%s CalDet 2D ch %d",GetTitle(),ch); + snprintf(name,1000,"%s CalDet 2D ch %d",GetTitle(),ch); TH2F * his = new TH2F(name, name, 400,-400.0,400.0,400,-400.0,400.0); // Where we begin @@ -410,7 +410,7 @@ TH2F *AliTRDCalDet::MakeHisto2DSmPl(Int_t sm, Int_t pl, Float_t min, Float_t max Double_t col0 = padPlane0->GetCol0(); char name[1000]; - sprintf(name,"%s CalDet 2D sm %d and pl %d",GetTitle(),sm,pl); + snprintf(name,1000,"%s CalDet 2D sm %d and pl %d",GetTitle(),sm,pl); TH2F * his = new TH2F( name, name, 5, -TMath::Abs(row0), TMath::Abs(row0) , 4,-2*TMath::Abs(col0),2*TMath::Abs(col0)); diff --git a/TRD/Cal/AliTRDCalMonitoring.cxx b/TRD/Cal/AliTRDCalMonitoring.cxx index 62c1697ff91..9d48a37a25b 100644 --- a/TRD/Cal/AliTRDCalMonitoring.cxx +++ b/TRD/Cal/AliTRDCalMonitoring.cxx @@ -81,5 +81,9 @@ AliTRDCalMonitoring::AliTRDCalMonitoring(const Text_t *name, const Text_t *title fLVVoltage[i] = 0; fLVCurrent[i] = 0; } + for (Int_t i=0; i<6700; ++i) { + fADCTresholds[i] = 0; + } + } diff --git a/TRD/Cal/AliTRDCalPad.cxx b/TRD/Cal/AliTRDCalPad.cxx index 65ff0f0a7fc..277ba62d723 100644 --- a/TRD/Cal/AliTRDCalPad.cxx +++ b/TRD/Cal/AliTRDCalPad.cxx @@ -450,7 +450,7 @@ TH2F *AliTRDCalPad::MakeHisto2DSmPl(Int_t sm, Int_t pl, const AliTRDCalDet *calD Double_t col0 = padPlane0->GetCol0(); char name[1000]; - sprintf(name,"%s Pad 2D sm %d pl %d",GetTitle(),sm,pl); + snprintf(name,1000,"%s Pad 2D sm %d pl %d",GetTitle(),sm,pl); TH2F * his = new TH2F( name, name, 76,-TMath::Abs(row0),TMath::Abs(row0),144,-TMath::Abs(col0),TMath::Abs(col0)); // Where we begin @@ -550,7 +550,7 @@ TH2F *AliTRDCalPad::MakeHisto2DCh(Int_t ch, const AliTRDCalDet *calDet, Int_t ty Double_t posglobal[3] = {0.0,0.0,0.0}; char name[1000]; - sprintf(name,"%s Pad 2D ch %d",GetTitle(),ch); + snprintf(name,1000,"%s Pad 2D ch %d",GetTitle(),ch); TH2F * his = new TH2F( name, name, 400,-400.0,400.0,400,-400.0,400.0); // Where we begin diff --git a/TRD/qaAnalysis/AliAnalysisTaskTRDmon.cxx b/TRD/qaAnalysis/AliAnalysisTaskTRDmon.cxx index 2f03df1725c..a216190fa75 100644 --- a/TRD/qaAnalysis/AliAnalysisTaskTRDmon.cxx +++ b/TRD/qaAnalysis/AliAnalysisTaskTRDmon.cxx @@ -626,7 +626,6 @@ void AliAnalysisTaskTRDmon::Exec(Option_t *){ for(Int_t itl = 0; itl < 6; itl++){ // TRD layers AliTRDseedV1 * tracklet = fTRDtrack->GetTracklet(itl); if(!tracklet || !tracklet->IsOK()) continue; - if(!tracklet) continue; nTracklets++; Int_t nclsTracklet = 0; for(Int_t itb = 0; itb < AliTRDseedV1::kNtb; itb++){ // timebins diff --git a/TRD/qaAnalysis/AliTRDqaJPsi.cxx b/TRD/qaAnalysis/AliTRDqaJPsi.cxx index f60049f5bbf..baef2747f6b 100644 --- a/TRD/qaAnalysis/AliTRDqaJPsi.cxx +++ b/TRD/qaAnalysis/AliTRDqaJPsi.cxx @@ -68,6 +68,10 @@ AliTRDqaJPsi:: AliTRDqaJPsi(const AliTRDqaJPsi & /*trd*/) // Copy constructor // + for (Int_t i = 0; i < 1000; i++) { + fSM[i] = 0; + } + } //______________________________________________________________________________ diff --git a/TRD/qaGui/AliTRDqaGuiBlackSM.cxx b/TRD/qaGui/AliTRDqaGuiBlackSM.cxx index bed624d9027..768667c52d4 100644 --- a/TRD/qaGui/AliTRDqaGuiBlackSM.cxx +++ b/TRD/qaGui/AliTRDqaGuiBlackSM.cxx @@ -70,7 +70,8 @@ AliTRDqaGuiBlackSM::AliTRDqaGuiBlackSM() fRangeNoise[i] = 0.0; } for (Int_t i = 0; i < 30; i++) { - fHistList[i] = 0x0; + fHistList[i] = 0x0; + fCanvasList[i] = 0x0; } strncpy(fFileName,"",256); -- 2.39.3