From: cblume Date: Tue, 9 Nov 2010 09:11:03 +0000 (+0000) Subject: Coverity defects (next round) X-Git-Url: http://git.uio.no/git/?a=commitdiff_plain;h=83c48644742d3940fd297f73671d51fedb59dd5e;p=u%2Fmrichter%2FAliRoot.git Coverity defects (next round) --- diff --git a/TRD/AliTRDptrgCBB.cxx b/TRD/AliTRDptrgCBB.cxx index 9c368195538..2d285e08917 100644 --- a/TRD/AliTRDptrgCBB.cxx +++ b/TRD/AliTRDptrgCBB.cxx @@ -158,6 +158,7 @@ Bool_t AliTRDptrgCBB::LoadParams() } lut->InitTable(12, 12, initData, kTRUE); // make a copy } + delete [] initData; AliTRDptrgParam::AliTRDptrgPTmasks* masks = new AliTRDptrgParam::AliTRDptrgPTmasks(); diff --git a/TRD/AliTRDptrgFEB.cxx b/TRD/AliTRDptrgFEB.cxx index a0effbd971d..60e15fed635 100644 --- a/TRD/AliTRDptrgFEB.cxx +++ b/TRD/AliTRDptrgFEB.cxx @@ -305,6 +305,7 @@ Bool_t AliTRDptrgFEB::LoadParams() } lut->InitTable(8, 8, initData, kTRUE); } + delete [] initData; } else { // initialize threshold @@ -335,7 +336,7 @@ Bool_t AliTRDptrgFEB::LoadParams() } lut->InitTable(12, 12, initData, kTRUE); // make a copy of the table } - delete[] initData; + delete [] initData; } return false; } diff --git a/TRD/AliTRDptrgParam.cxx b/TRD/AliTRDptrgParam.cxx index d1160b7698a..e4de883d031 100644 --- a/TRD/AliTRDptrgParam.cxx +++ b/TRD/AliTRDptrgParam.cxx @@ -1499,15 +1499,20 @@ Bool_t AliTRDptrgParam::ParseTLMU(TString identifier, TString value) { for (Int_t iEntry = 0; iEntry < arr.GetEntries(); iEntry++) { TObjString *ostrng = dynamic_cast(arr[iEntry]); - TString t = ostrng->GetString(); + if (ostrng) { + + TString t = ostrng->GetString(); - TString indexStr = t(2,1); - if (t.Index("CM") == 0) { // coincidence matrix - this->fTLMUoutput[iEntry][0] = indexStr.Atoi(); - } - else if (t.Index("MC") == 0) { // multiplicity - this->fTLMUoutput[iEntry][1] = indexStr.Atoi(); + TString indexStr = t(2,1); + if (t.Index("CM") == 0) { // coincidence matrix + this->fTLMUoutput[iEntry][0] = indexStr.Atoi(); + } + else if (t.Index("MC") == 0) { // multiplicity + this->fTLMUoutput[iEntry][1] = indexStr.Atoi(); + } + } + AliDebug(5, Form("TLMU output: cm = %d, mc = %d", this->fTLMUoutput[iEntry][0], this->fTLMUoutput[iEntry][1])); @@ -1900,29 +1905,36 @@ Int_t* AliTRDptrgParam::GenerateLUTbasedOnEq(TString eq, Int_t inputWidth, ConvertLogicalEqToBitVectors(eq, results, signalsInvolved); // generate bit vectors + + if ((results != 0x0) && (signalsInvolved != 0x0)) { - CheckSignalsInvolved(results, signalsInvolved, inputWidth); - // add bit vectors for signals which are not taken into account + CheckSignalsInvolved(results, signalsInvolved, inputWidth); + // add bit vectors for signals which are not taken into account - Int_t lutSize = 0x1 << inputWidth; // 2^inputwidth elements - Int_t* resultingLUT = new Int_t[lutSize]; // create LUT - for (Int_t iLUTentry = 0; iLUTentry < lutSize; iLUTentry++) { // init LUT - resultingLUT[iLUTentry] = 0; - } - for (Int_t iEntry = 0; iEntry < results->GetSize(); iEntry++) { - resultingLUT[(*results)[iEntry]] = initValue; - } + Int_t lutSize = 0x1 << inputWidth; // 2^inputwidth elements + Int_t* resultingLUT = new Int_t[lutSize]; // create LUT + for (Int_t iLUTentry = 0; iLUTentry < lutSize; iLUTentry++) { // init LUT + resultingLUT[iLUTentry] = 0; + } + for (Int_t iEntry = 0; iEntry < results->GetSize(); iEntry++) { + resultingLUT[(*results)[iEntry]] = initValue; + } - if (results != 0x0) { delete results; results = 0x0; - } - if (signalsInvolved != 0x0) { + delete signalsInvolved; signalsInvolved = 0x0; - } - return resultingLUT; + return resultingLUT; + + } + else { + + return 0x0; + + } + } //______________________________________________________________________________