From af8c5d555787f2d3776543267b64b7b41dc96a1a Mon Sep 17 00:00:00 2001 From: John Harvey Date: Tue, 28 Feb 2017 13:49:19 +0100 Subject: [PATCH 01/54] coverity bugfix 93580: parameters for day montha year were in wrong order --- sql/pgsql/src/TPgSQLStatement.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/pgsql/src/TPgSQLStatement.cxx b/sql/pgsql/src/TPgSQLStatement.cxx index 84b0c0a0e2af3..4334835f8e5eb 100644 --- a/sql/pgsql/src/TPgSQLStatement.cxx +++ b/sql/pgsql/src/TPgSQLStatement.cxx @@ -568,7 +568,7 @@ Bool_t TPgSQLStatement::GetTime(Int_t npar, Int_t& hour, Int_t& min, Int_t& sec) Int_t year = d.GetYear(); Int_t month = d.GetMonth(); Int_t day = d.GetDay(); - ConvertTimeToUTC(val, day, month, year, hour, min, sec); + ConvertTimeToUTC(val, year, month, day, hour, min, sec); return kTRUE; } From 89a4a67639aa144f6b7b735b5fe7ff3e43780b9a Mon Sep 17 00:00:00 2001 From: John Harvey Date: Wed, 1 Mar 2017 09:51:52 +0100 Subject: [PATCH 02/54] coverity 94012: removed redundant unreachable return statement --- sql/mysql/src/TMySQLStatement.cxx | 2 -- 1 file changed, 2 deletions(-) diff --git a/sql/mysql/src/TMySQLStatement.cxx b/sql/mysql/src/TMySQLStatement.cxx index 49145e0f3b10d..1ee05d6b3cb6a 100644 --- a/sql/mysql/src/TMySQLStatement.cxx +++ b/sql/mysql/src/TMySQLStatement.cxx @@ -464,8 +464,6 @@ long double TMySQLStatement::ConvertToNumeric(Int_t npar) default: return 0; } - - return 0; } //////////////////////////////////////////////////////////////////////////////// From 1f8f13735e6332996c55903fd7a02f43090b51b2 Mon Sep 17 00:00:00 2001 From: John Harvey Date: Wed, 1 Mar 2017 10:48:00 +0100 Subject: [PATCH 03/54] coverity 82573: fixed copy paste error fXaxis to fZaxis --- hist/hist/src/TH1Merger.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hist/hist/src/TH1Merger.cxx b/hist/hist/src/TH1Merger.cxx index 3754bc5d132b3..124dd63c8f71e 100644 --- a/hist/hist/src/TH1Merger.cxx +++ b/hist/hist/src/TH1Merger.cxx @@ -514,7 +514,7 @@ Bool_t TH1Merger::DifferentAxesMerge() { } } if (binz <= 0 || binz >= hist->GetNbinsZ() + 1) { - if (fH0->fZaxis.CanExtend() || ( hist->fZaxis.GetBinCenter(binz) > fH0->fZaxis.GetXmin() && hist->fXaxis.GetBinCenter(binz) < fH0->fZaxis.GetXmax()) ) { + if (fH0->fZaxis.CanExtend() || ( hist->fZaxis.GetBinCenter(binz) > fH0->fZaxis.GetXmin() && hist->fZaxis.GetBinCenter(binz) < fH0->fZaxis.GetXmax()) ) { Error("TH1Merger::DifferentAxesMerge", "Cannot merge histograms - the histograms %s can extend the Z axis or have" " different limits and underflows/overflows are present in the histogram %s.",fH0->GetName(),hist->GetName()); return kFALSE; From baa8987092183258f7b88ba2340e9274ce37d33a Mon Sep 17 00:00:00 2001 From: John Harvey Date: Wed, 1 Mar 2017 14:21:29 +0100 Subject: [PATCH 04/54] Coverity 82274: fixed uninitialised class members --- math/matrix/inc/TVectorT.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/math/matrix/inc/TVectorT.h b/math/matrix/inc/TVectorT.h index 3fb5646ecd93b..284abeae658c6 100644 --- a/math/matrix/inc/TVectorT.h +++ b/math/matrix/inc/TVectorT.h @@ -27,15 +27,15 @@ template class TVectorT : public TObject { protected: - Int_t fNrows; // number of rows - Int_t fRowLwb; // lower bound of the row index - Element *fElements; //[fNrows] elements themselves + Int_t fNrows{0}; // number of rows + Int_t fRowLwb{0}; // lower bound of the row index + Element *fElements{nullptr}; //[fNrows] elements themselves enum {kSizeMax = 5}; // size data container on stack, see New_m(),Delete_m() enum {kWorkMax = 100}; // size of work array's in several routines Element fDataStack[kSizeMax]; //! data container - Bool_t fIsOwner; //!default kTRUE, when Use array kFALSE + Bool_t fIsOwner{kTRUE}; //!default kTRUE, when Use array kFALSE Element* New_m (Int_t size); void Delete_m(Int_t size,Element*&); From 7b0feb1172b57e1591e0cd82b63dc451907e4154 Mon Sep 17 00:00:00 2001 From: John Harvey Date: Wed, 1 Mar 2017 17:15:05 +0100 Subject: [PATCH 05/54] coverity 94049: class member not initialised --- sql/oracle/src/TOracleResult.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/sql/oracle/src/TOracleResult.cxx b/sql/oracle/src/TOracleResult.cxx index 818f10757ce27..ae59687cc5a0f 100644 --- a/sql/oracle/src/TOracleResult.cxx +++ b/sql/oracle/src/TOracleResult.cxx @@ -78,6 +78,7 @@ TOracleResult::TOracleResult(Connection *conn, const char *tableName) fFieldInfo = 0; fResultType = 0; fUpdateCount = 0; + fFieldCount = 0; if (!tableName || !conn) { Error("TOracleResult", "construction: empty input parameter"); From 7db5e8cca78f774646763da0a7acf825e5318db4 Mon Sep 17 00:00:00 2001 From: John Harvey Date: Wed, 1 Mar 2017 17:40:36 +0100 Subject: [PATCH 06/54] Coverity 94053: fixed uninitialised class members --- tmva/pymva/inc/TMVA/MethodPyKeras.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tmva/pymva/inc/TMVA/MethodPyKeras.h b/tmva/pymva/inc/TMVA/MethodPyKeras.h index a34ca4bc9651e..e9f8eadf8a4c3 100644 --- a/tmva/pymva/inc/TMVA/MethodPyKeras.h +++ b/tmva/pymva/inc/TMVA/MethodPyKeras.h @@ -72,19 +72,19 @@ namespace TMVA { private: TString fFilenameModel; // Filename of the previously exported Keras model - UInt_t fBatchSize; // Training batch size - UInt_t fNumEpochs; // Number of training epochs + UInt_t fBatchSize {0}; // Training batch size + UInt_t fNumEpochs {0}; // Number of training epochs Int_t fVerbose; // Keras verbosity during training Bool_t fContinueTraining; // Load weights from previous training Bool_t fSaveBestOnly; // Store only weights with smallest validation loss Int_t fTriesEarlyStopping; // Stop training if validation loss is not decreasing for several epochs TString fLearningRateSchedule; // Set new learning rate at specific epochs - bool fModelIsSetup; // flag whether model is loaded, neede for getMvaValue during evaluation - float* fVals; // variables array used for GetMvaValue + bool fModelIsSetup = false; // flag whether model is loaded, neede for getMvaValue during evaluation + float* fVals = nullptr; // variables array used for GetMvaValue std::vector fOutput; // probability or regression output array used for GetMvaValue - UInt_t fNVars; // number of variables - UInt_t fNOutputs; // number of outputs (classes or targets) + UInt_t fNVars {0}; // number of variables + UInt_t fNOutputs {0}; // number of outputs (classes or targets) TString fFilenameTrainedModel; // output filename for trained model void SetupKerasModel(Bool_t loadTrainedModel); // setups the needed variables loads the model From 91ae8954cde0306de402fb670e476ea1415bf641 Mon Sep 17 00:00:00 2001 From: John Harvey Date: Tue, 7 Mar 2017 17:23:44 +0100 Subject: [PATCH 07/54] 4 coverity bugfixes --- hist/hist/src/TFormula.cxx | 1 + hist/hist/src/TGraphAsymmErrors.cxx | 2 +- hist/hist/src/TH1Merger.cxx | 1 - math/mathcore/src/TKDTreeBinning.cxx | 3 ++- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/hist/hist/src/TFormula.cxx b/hist/hist/src/TFormula.cxx index 7fc2329cb8ea5..abf39290faf08 100644 --- a/hist/hist/src/TFormula.cxx +++ b/hist/hist/src/TFormula.cxx @@ -408,6 +408,7 @@ TFormula::TFormula(const TFormula &formula) : fNumber = formula.GetNumber(); fFormula = formula.GetExpFormula(); // returns fFormula in case of Lambda's fLambdaPtr = nullptr; + fFuncPtr = nullptr; // case of function based on a C++ expression (lambda's) which is ready to be compiled if (formula.fLambdaPtr && formula.TestBit(TFormula::kLambda)) { diff --git a/hist/hist/src/TGraphAsymmErrors.cxx b/hist/hist/src/TGraphAsymmErrors.cxx index 7a9831fd89294..6fd46aa986295 100644 --- a/hist/hist/src/TGraphAsymmErrors.cxx +++ b/hist/hist/src/TGraphAsymmErrors.cxx @@ -613,7 +613,7 @@ void TGraphAsymmErrors::Divide(const TH1* pass, const TH1* total, Option_t *opt) } } else { - tsumw = pass->GetSumOfWeights(); + tsumw = total->GetSumOfWeights(); tsumw2 = tsumw; } if (TMath::Abs(tsumw - tsumw2) > 1e-6) diff --git a/hist/hist/src/TH1Merger.cxx b/hist/hist/src/TH1Merger.cxx index 124dd63c8f71e..ce4076b776e6a 100644 --- a/hist/hist/src/TH1Merger.cxx +++ b/hist/hist/src/TH1Merger.cxx @@ -200,7 +200,6 @@ TH1Merger::EMergerType TH1Merger::ExamineHistograms() { // if histogram is empty it does not matter if it has label or not if (allHaveLabels && !histoIsEmpty) { - if (histoIsEmpty) continue; THashList* hlabels=h->GetXaxis()->GetLabels(); Bool_t haveOneLabel = (hlabels != nullptr); // do here to print message only one time diff --git a/math/mathcore/src/TKDTreeBinning.cxx b/math/mathcore/src/TKDTreeBinning.cxx index e2a444db98c3d..891d1dddf31f7 100644 --- a/math/mathcore/src/TKDTreeBinning.cxx +++ b/math/mathcore/src/TKDTreeBinning.cxx @@ -96,7 +96,7 @@ fIsSorted(kFALSE), fIsSortedAsc(kFALSE), fBinsContent(std::vector()) { /// The size of thedata vector must be at least dataDim*dataSize /// TKDTreeBinning::TKDTreeBinning(UInt_t dataSize, UInt_t dataDim, const std::vector &data, UInt_t nBins, bool adjustBinEdges) -: fData(0), fBinMinEdges(std::vector()), fBinMaxEdges(std::vector()), fDataBins((TKDTreeID*)0), fDim(dataDim), +: fData(0), fBinMinEdges(std::vector()), fBinMaxEdges(std::vector()), fDataBins((TKDTreeID*)0), fNBins (nBins), fDim(dataDim), fDataSize(dataSize), fDataThresholds(std::vector >(fDim, std::make_pair(0., 0.))), fIsSorted(kFALSE), fIsSortedAsc(kFALSE), fBinsContent(std::vector()) { if (adjustBinEdges) SetBit(kAdjustBinEdges); @@ -113,6 +113,7 @@ fIsSorted(kFALSE), fIsSortedAsc(kFALSE), fBinsContent(std::vector()) { TKDTreeBinning::TKDTreeBinning() : // fData(nullptr), fDataBins(nullptr), + fNBins (0), fDim(0), fDataSize(0), fIsSorted(kFALSE), fIsSortedAsc(kFALSE) From 4929ff45b20f22b7eac3177c12853da62d491792 Mon Sep 17 00:00:00 2001 From: John Harvey Date: Wed, 8 Mar 2017 18:11:10 +0100 Subject: [PATCH 08/54] coverity fixes: 63257, 62811, 62809, 62773, 62332, 62321 --- hist/hist/src/TFormula.cxx | 2 ++ math/mathcore/inc/Math/RandomFunctions.h | 4 ++-- math/mathcore/src/Delaunay2D.cxx | 1 + math/mathmore/src/GSLMultiFitFunctionWrapper.h | 1 + math/mathmore/test/testInterpolation.cxx | 2 +- test/stressMathMore.cxx | 3 ++- 6 files changed, 9 insertions(+), 4 deletions(-) diff --git a/hist/hist/src/TFormula.cxx b/hist/hist/src/TFormula.cxx index abf39290faf08..ea46fb81c357c 100644 --- a/hist/hist/src/TFormula.cxx +++ b/hist/hist/src/TFormula.cxx @@ -361,7 +361,9 @@ TFormula::TFormula(const char *name, const char *formula, int ndim, int npar, bo fClingInitialized = false; fNpar = 0; fMethod = 0; + fNumber = 0; fLambdaPtr = nullptr; + fFuncPtr = nullptr; fNdim = ndim; diff --git a/math/mathcore/inc/Math/RandomFunctions.h b/math/mathcore/inc/Math/RandomFunctions.h index a99008dc7bb3c..d9af4a91f51e7 100644 --- a/math/mathcore/inc/Math/RandomFunctions.h +++ b/math/mathcore/inc/Math/RandomFunctions.h @@ -71,7 +71,7 @@ namespace Math { public: /// class constructor - RandomFunctionsImpl() {} + RandomFunctionsImpl() : fBaseEngine(0) {} void SetEngine(void *r) { fBaseEngine = static_cast(r); @@ -123,7 +123,7 @@ namespace Math { double Uniform(double a); protected: - TRandomEngine * fBaseEngine; + TRandomEngine* fBaseEngine; private: // Internal method used by the functions diff --git a/math/mathcore/src/Delaunay2D.cxx b/math/mathcore/src/Delaunay2D.cxx index e60c5b8d52327..340392f62d1ed 100644 --- a/math/mathcore/src/Delaunay2D.cxx +++ b/math/mathcore/src/Delaunay2D.cxx @@ -39,6 +39,7 @@ Delaunay2D::Delaunay2D(int n, const double * x, const double * y, const double * fX = x; fY = y; fZ = z; + fZout = 0.; fNpoints = n; fOffsetX = 0; fOffsetY = 0; diff --git a/math/mathmore/src/GSLMultiFitFunctionWrapper.h b/math/mathmore/src/GSLMultiFitFunctionWrapper.h index d3639bf4d2886..c38fd98574f5c 100644 --- a/math/mathmore/src/GSLMultiFitFunctionWrapper.h +++ b/math/mathmore/src/GSLMultiFitFunctionWrapper.h @@ -67,6 +67,7 @@ class GSLMultiFitFunctionWrapper { fFunc.n = 0; fFunc.p = 0; fFunc.params = 0; + fFunc.nevalf = 0; } diff --git a/math/mathmore/test/testInterpolation.cxx b/math/mathmore/test/testInterpolation.cxx index 63ca9b8d6dfc6..5abcc586e975c 100644 --- a/math/mathmore/test/testInterpolation.cxx +++ b/math/mathmore/test/testInterpolation.cxx @@ -32,7 +32,7 @@ void interpolate( const ROOT::Math::Interpolator & itp, bool drawSame = false ) const Int_t n = 51; Int_t i = 0; Float_t xcoord[n], ycoord[n]; - for ( double xi = 0; xi < 10; xi += 0.2) { + for ( double xi = 0; xi < 10.01; xi += 0.2) { xcoord[i] = xi; ycoord[i] = itp.Eval(xi); double dyi = itp.Deriv(xi); diff --git a/test/stressMathMore.cxx b/test/stressMathMore.cxx index 68bb4544edc4d..860d4c87cbd17 100644 --- a/test/stressMathMore.cxx +++ b/test/stressMathMore.cxx @@ -149,8 +149,9 @@ class StatFunction : public ROOT::Math::IParamFunction { double x1 = -INF, double x2 = INF ) : fPdf(&pdf), fCdf(&cdf), fQuant(&quant), + xmin(0.), xmax(0.) xlow(x1), xup(x2), - fHasLowRange(false), fHasUpRange(false) + fHasLowRange(false), fHasUpRange(false), fStartRoot(0.) { fScaleIg = 10; //scale for integral test fScaleDer = 1; //scale for der test From c34c70dc2a21120b3a5e2f4763ca0ec0d9576f62 Mon Sep 17 00:00:00 2001 From: John Harvey Date: Fri, 10 Mar 2017 17:03:47 +0100 Subject: [PATCH 09/54] coverity bugfixes: 62314,61873,61615,61605,61599,61590,61554 --- hist/hist/src/TF1NormSum.cxx | 2 +- math/mathmore/test/testGSLIntegration.cxx | 4 +++- math/minuit/src/TFitter.cxx | 6 +++++- math/minuit2/inc/Minuit2/FumiliChi2FCN.h | 1 + test/stressHistoFit.cxx | 3 ++- test/stressHistogram.cxx | 2 +- test/stressTMVA.cxx | 7 +++++++ 7 files changed, 20 insertions(+), 5 deletions(-) diff --git a/hist/hist/src/TF1NormSum.cxx b/hist/hist/src/TF1NormSum.cxx index be2bd37ec23fd..f6937444fefa2 100644 --- a/hist/hist/src/TF1NormSum.cxx +++ b/hist/hist/src/TF1NormSum.cxx @@ -177,7 +177,7 @@ TF1NormSum::TF1NormSum(TF1* function1, TF1* function2, TF1* function3, Double_t } if (function3) { fnew3 = (TF1*) function3->IsA()->New(); - function3->Copy(*fnew2); + function3->Copy(*fnew3); } if (!fnew1 || !fnew2 || !fnew3 ) Fatal("TF1NormSum","Invalid input functions - Abort"); diff --git a/math/mathmore/test/testGSLIntegration.cxx b/math/mathmore/test/testGSLIntegration.cxx index 2b0647ce8357e..05fcf1af97494 100644 --- a/math/mathmore/test/testGSLIntegration.cxx +++ b/math/mathmore/test/testGSLIntegration.cxx @@ -2,6 +2,7 @@ #include "Math/Functor.h" #include "Math/Error.h" #include +#include #ifdef HAVE_ROOTLIBS @@ -75,6 +76,7 @@ int testIntegration() { double value = ig.Integral( 0, 3); // or ig.Integral(*f, 0, 10); if new function + std::streamsize ss = std::cout.precision(); std::cout.precision(20); std::cout << "Adaptive singular integration:" << std::endl; @@ -146,7 +148,7 @@ int testIntegration() { status &= fabs(ig.Result() - (2.-2*sqrt(0.5))) > ERRORLIMIT; if (status) MATH_ERROR_MSG("testGSLIntegration","Adaptive integration with singular points 2 failed on 1./sqrt(x)"); - + std::cout.precision(ss); return status; } diff --git a/math/minuit/src/TFitter.cxx b/math/minuit/src/TFitter.cxx index 4c6f8bf5b5dea..b3402c3b4e642 100644 --- a/math/minuit/src/TFitter.cxx +++ b/math/minuit/src/TFitter.cxx @@ -137,8 +137,12 @@ void TFitter::GetConfidenceIntervals(Int_t n, Int_t ndim, const Double_t *x, Dou Double_t c=0; Double_t *matr = GetCovarianceMatrix(); - if (!matr) + if (!matr){ + delete [] grad; + delete [] sum_vector; return; + } + Double_t t = TMath::StudentQuantile(0.5 + cl/2, f->GetNDF()); Double_t chidf = TMath::Sqrt(f->GetChisquare()/f->GetNDF()); Int_t igrad, ifree=0; diff --git a/math/minuit2/inc/Minuit2/FumiliChi2FCN.h b/math/minuit2/inc/Minuit2/FumiliChi2FCN.h index e9819b2e2b904..379ebc991f3c3 100644 --- a/math/minuit2/inc/Minuit2/FumiliChi2FCN.h +++ b/math/minuit2/inc/Minuit2/FumiliChi2FCN.h @@ -56,6 +56,7 @@ class FumiliChi2FCN : public FumiliFCNBase { FumiliChi2FCN() {} virtual ~FumiliChi2FCN() {} + fModelFunction = nullptr; diff --git a/test/stressHistoFit.cxx b/test/stressHistoFit.cxx index 18a7a0ca8c5e5..0c2fe2e75ca11 100644 --- a/test/stressHistoFit.cxx +++ b/test/stressHistoFit.cxx @@ -288,7 +288,8 @@ class fitFunctions { public: TString name; double (*func)(double*, double*); - unsigned int npars; + func = nullptr; + unsigned int npars = 0; vector origPars; vector fitPars; vector parLimits; diff --git a/test/stressHistogram.cxx b/test/stressHistogram.cxx index 0d0315ea185cf..b52475160901d 100644 --- a/test/stressHistogram.cxx +++ b/test/stressHistogram.cxx @@ -10411,7 +10411,7 @@ int equals(const char* msg, THnBase* s, TH1* h2, int options, double ERRORLIMIT) if ( print || debug ) std::cout << msg << ": \t" << (differents?"FAILED":"OK") << std::endl; if (cleanHistos) delete h2; - + delete[] coord; return differents; } diff --git a/test/stressTMVA.cxx b/test/stressTMVA.cxx index 026d18ce475ed..bc9c6f0e6ed0e 100644 --- a/test/stressTMVA.cxx +++ b/test/stressTMVA.cxx @@ -1781,6 +1781,9 @@ utVariableInfo::utVariableInfo() : mean = 42.; rms = 47.11; + _varinfoC1 = nullptr; + _varinfoC2 = nullptr; + _varinfoC3 = nullptr; } @@ -2655,6 +2658,10 @@ MethodUnitTestWithComplexData::MethodUnitTestWithComplexData(const TString& tree const std::string & /* xname */ ,const std::string & /* filename */ , std::ostream* /* sptr */) : UnitTest(string("ComplexData_")+(string)methodTitle+(string)treestring, __FILE__), _methodType(theMethod) , _treeString(treestring), _prepareString(preparestring), _methodTitle(methodTitle), _methodOption(theOption), _upROCLimit(upLimit), _lowROCLimit(lowLimit) { + theTree = nullptr; + _theMethod = nullptr; + _factory = nullptr; + _ROCValue = 0.; } From f67b62925a5d2198d32885908af44e19c46caade Mon Sep 17 00:00:00 2001 From: John Harvey Date: Mon, 13 Mar 2017 11:06:51 +0100 Subject: [PATCH 10/54] fixed missing initialisation of fModelFunction ptr --- math/minuit2/inc/Minuit2/FumiliChi2FCN.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/math/minuit2/inc/Minuit2/FumiliChi2FCN.h b/math/minuit2/inc/Minuit2/FumiliChi2FCN.h index 379ebc991f3c3..6af985ef08d2d 100644 --- a/math/minuit2/inc/Minuit2/FumiliChi2FCN.h +++ b/math/minuit2/inc/Minuit2/FumiliChi2FCN.h @@ -56,8 +56,6 @@ class FumiliChi2FCN : public FumiliFCNBase { FumiliChi2FCN() {} virtual ~FumiliChi2FCN() {} - fModelFunction = nullptr; - /** @@ -170,7 +168,7 @@ class FumiliChi2FCN : public FumiliFCNBase { private: // A pointer to the model function which describes the data - const ParametricFunction *fModelFunction; + const ParametricFunction *fModelFunction = nullptr; From b02cea7494e76aacf54d60da982d6fc77b81bf79 Mon Sep 17 00:00:00 2001 From: John Harvey Date: Wed, 15 Mar 2017 09:12:34 +0100 Subject: [PATCH 11/54] coverity 68080: 2 uninitialised class members --- tmva/tmva/src/MethodBoost.cxx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tmva/tmva/src/MethodBoost.cxx b/tmva/tmva/src/MethodBoost.cxx index 1349e5d53d479..218497d2f6824 100644 --- a/tmva/tmva/src/MethodBoost.cxx +++ b/tmva/tmva/src/MethodBoost.cxx @@ -112,6 +112,8 @@ ClassImp(TMVA::MethodBoost) , fMVAvalues(0) { fMVAvalues = new std::vector; + fDataSetManager = NULL; + fHistoricBoolOption = kFALSE; } //////////////////////////////////////////////////////////////////////////////// From 980512004580989b3ec19688a476e563542edc7d Mon Sep 17 00:00:00 2001 From: John Harvey Date: Wed, 15 Mar 2017 09:14:03 +0100 Subject: [PATCH 12/54] coverity 68081 and 68084: several uninitialised class members --- tmva/tmva/src/MethodPDERS.cxx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tmva/tmva/src/MethodPDERS.cxx b/tmva/tmva/src/MethodPDERS.cxx index c1200849935df..d25a0d12ed78e 100644 --- a/tmva/tmva/src/MethodPDERS.cxx +++ b/tmva/tmva/src/MethodPDERS.cxx @@ -126,6 +126,8 @@ ClassImp(TMVA::MethodPDERS) fPrinted(0), fNormTree(0) { + fHelpVolume = NULL; + fBinaryTree = NULL; } //////////////////////////////////////////////////////////////////////////////// @@ -156,6 +158,8 @@ TMVA::MethodPDERS::MethodPDERS( DataSetInfo& theData, fPrinted(0), fNormTree(0) { + fHelpVolume = NULL; + fBinaryTree = NULL; } //////////////////////////////////////////////////////////////////////////////// From f8e16e0ac8164b3028d571fb8eb40d03407686fd Mon Sep 17 00:00:00 2001 From: John Harvey Date: Wed, 15 Mar 2017 09:18:45 +0100 Subject: [PATCH 13/54] coverity 68087 and 68086: uninitialised pointers --- tmva/tmva/src/MethodRuleFit.cxx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tmva/tmva/src/MethodRuleFit.cxx b/tmva/tmva/src/MethodRuleFit.cxx index b58055a9a6dc1..fe66063052108 100644 --- a/tmva/tmva/src/MethodRuleFit.cxx +++ b/tmva/tmva/src/MethodRuleFit.cxx @@ -111,6 +111,7 @@ ClassImp(TMVA::MethodRuleFit) , fRuleMinDist(0) , fLinQuantile(0) { + fMonitorNtuple = NULL; } //////////////////////////////////////////////////////////////////////////////// @@ -158,6 +159,7 @@ TMVA::MethodRuleFit::MethodRuleFit( DataSetInfo& theData, , fRuleMinDist(0) , fLinQuantile(0) { + fMonitorNtuple = NULL; } //////////////////////////////////////////////////////////////////////////////// From c9e83d54b107f56bf1f2ead67d333a39a77182bd Mon Sep 17 00:00:00 2001 From: John Harvey Date: Wed, 15 Mar 2017 09:28:08 +0100 Subject: [PATCH 14/54] coverity bug: uninitialised pointer --- .../src/lib/Transforms/Instrumentation/EfficiencySanitizer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interpreter/llvm/src/lib/Transforms/Instrumentation/EfficiencySanitizer.cpp b/interpreter/llvm/src/lib/Transforms/Instrumentation/EfficiencySanitizer.cpp index 6640e7b54bd77..e47ef83c425a1 100644 --- a/interpreter/llvm/src/lib/Transforms/Instrumentation/EfficiencySanitizer.cpp +++ b/interpreter/llvm/src/lib/Transforms/Instrumentation/EfficiencySanitizer.cpp @@ -716,7 +716,7 @@ bool EfficiencySanitizer::instrumentGetElementPtr(Instruction *I, Module &M) { return false; } Type *SourceTy = GepInst->getSourceElementType(); - StructType *StructTy; + StructType *StructTy = nullptr; ConstantInt *Idx; // Check if GEP calculates address from a struct array. if (isa(SourceTy)) { From b69fb346f9755c963f8ce31dcc773d8821b90199 Mon Sep 17 00:00:00 2001 From: John Harvey Date: Fri, 17 Mar 2017 17:08:20 +0100 Subject: [PATCH 15/54] coverity 82584,82583,82582,82581,82580,82579 --- hist/unfold/src/TUnfold.cxx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/hist/unfold/src/TUnfold.cxx b/hist/unfold/src/TUnfold.cxx index 75dce1ed0a182..4ed00afc0e9d7 100644 --- a/hist/unfold/src/TUnfold.cxx +++ b/hist/unfold/src/TUnfold.cxx @@ -2726,13 +2726,13 @@ Int_t TUnfold::ScanLcurve(Int_t nPoint, Double_t logTauFin=(*i0).first; if( ((int)curve.size())0) { - Double_t *x=new Double_t[curve.size()]; - Double_t *y=new Double_t[curve.size()]; - Double_t *logT=new Double_t[curve.size()]; + Double_t *x=new Double_t[curve.size()](); + Double_t *y=new Double_t[curve.size()](); + Double_t *logT=new Double_t[curve.size()](); int n=0; for( XYtau_t::const_iterator i=curve.begin();i!=curve.end();i++) { if(logTauFin==(*i).first) { From 2e9e71e806d731d8d5d73a3f621fc145415e8697 Mon Sep 17 00:00:00 2001 From: John Harvey Date: Fri, 17 Mar 2017 17:09:58 +0100 Subject: [PATCH 16/54] coverity 82578 --- hist/unfold/src/TUnfoldBinning.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hist/unfold/src/TUnfoldBinning.cxx b/hist/unfold/src/TUnfoldBinning.cxx index 242eaaf699109..2551bae9399a7 100644 --- a/hist/unfold/src/TUnfoldBinning.cxx +++ b/hist/unfold/src/TUnfoldBinning.cxx @@ -1632,7 +1632,7 @@ Int_t TUnfoldBinning::GetGlobalBinNumber "no axes are defined for node %s", (char const *)GetName()); } - Int_t iAxisBins[MAXDIM]; + Int_t iAxisBins[MAXDIM] = {0}; for(Int_t dim=0;dimAt(dim); Int_t i0=0; From 408d86c3d68b5828a30556ebad5b83eba5831700 Mon Sep 17 00:00:00 2001 From: John Harvey Date: Fri, 17 Mar 2017 17:19:53 +0100 Subject: [PATCH 17/54] Coverity 68966: truncated return value in mixmax --- math/mathcore/src/mixmax.icc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/math/mathcore/src/mixmax.icc b/math/mathcore/src/mixmax.icc index 8016987b361b8..9b9a51b45313f 100644 --- a/math/mathcore/src/mixmax.icc +++ b/math/mathcore/src/mixmax.icc @@ -287,7 +287,7 @@ void read_state(rng_state_t* X, const char filename[] ){ // a function for reading the state from a file, after J. Apostolakis FILE* fin; if( ( fin = fopen(filename, "r") ) ){ - char l=0; + int l=0; while ( l != '{' ) { // 0x7B = "{" l=fgetc(fin); // proceed until hitting opening bracket } From 09c2745c92ea0c4861ccfd73c65b554f23352470 Mon Sep 17 00:00:00 2001 From: John Harvey Date: Fri, 17 Mar 2017 17:27:50 +0100 Subject: [PATCH 18/54] coverity 82576,82575 --- test/stressHistogram.cxx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/stressHistogram.cxx b/test/stressHistogram.cxx index 2328d81eb01f5..70874e1f25157 100644 --- a/test/stressHistogram.cxx +++ b/test/stressHistogram.cxx @@ -10239,6 +10239,10 @@ int stressHistogram() << gROOT->GetGitBranch() << "@" << gROOT->GetGitCommit() << std::endl; std::cout <<"****************************************************************************\n"; + if (cleanHistos) { + delete ht2; + delete htp2; + } return GlobalStatus; } From 6964ee86ce32d83b1d5face6250b627ba6540fb2 Mon Sep 17 00:00:00 2001 From: John Harvey Date: Fri, 17 Mar 2017 17:29:48 +0100 Subject: [PATCH 19/54] coverity 68746,68745 --- tmva/tmva/inc/TMVA/DNN/Layer.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tmva/tmva/inc/TMVA/DNN/Layer.h b/tmva/tmva/inc/TMVA/DNN/Layer.h index a56c39e10bb02..4f749c849feb8 100644 --- a/tmva/tmva/inc/TMVA/DNN/Layer.h +++ b/tmva/tmva/inc/TMVA/DNN/Layer.h @@ -249,6 +249,7 @@ TLayer::TLayer(const TLayer &layer) { Architecture_t::Copy(fWeights, layer.GetWeights()); Architecture_t::Copy(fBiases, layer.GetBiases()); + fDropoutProbability = 0.; } //______________________________________________________________________________ @@ -335,7 +336,7 @@ TSharedLayer::TSharedLayer(const TSharedLayer &layer) fBiasGradients(fWidth, 1), fActivationGradients(layer.fBatchSize, fWidth), fF(layer.fF) { - // Nothing to do here. + fDropoutProbability = 0.; } //______________________________________________________________________________ From d013685c5ef2997e65060a0ce8544205cade2825 Mon Sep 17 00:00:00 2001 From: John Harvey Date: Fri, 17 Mar 2017 17:34:29 +0100 Subject: [PATCH 20/54] coverity 68958,68853,68852,68849 --- tmva/tmva/inc/TMVA/DataLoader.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tmva/tmva/inc/TMVA/DataLoader.h b/tmva/tmva/inc/TMVA/DataLoader.h index a980e7e3c58db..d0d206dee25f8 100644 --- a/tmva/tmva/inc/TMVA/DataLoader.h +++ b/tmva/tmva/inc/TMVA/DataLoader.h @@ -213,8 +213,8 @@ namespace TMVA { std::vector> fTestSigEvents; std::vector> fTestBkgEvents; - Int_t fATreeType; // type of event (=classIndex) - Float_t fATreeWeight; // weight of the event + Int_t fATreeType = 0; // type of event (=classIndex) + Float_t fATreeWeight = 0.0; // weight of the event std::vector fATreeEvent; // event variables Types::EAnalysisType fAnalysisType; // the training type From b3ad363ea181e24f8618b0e232ecdc23d706549b Mon Sep 17 00:00:00 2001 From: John Harvey Date: Fri, 17 Mar 2017 17:37:22 +0100 Subject: [PATCH 21/54] coverity 68860,68857 --- tmva/tmva/inc/TMVA/HyperParameterOptimisation.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmva/tmva/inc/TMVA/HyperParameterOptimisation.h b/tmva/tmva/inc/TMVA/HyperParameterOptimisation.h index 69a1772bdf1cb..9ac899fb87e5e 100644 --- a/tmva/tmva/inc/TMVA/HyperParameterOptimisation.h +++ b/tmva/tmva/inc/TMVA/HyperParameterOptimisation.h @@ -30,7 +30,7 @@ namespace TMVA { friend class HyperParameterOptimisation; private: std::vector fROCs; - Float_t fROCAVG; + Float_t fROCAVG = 0.0; std::shared_ptr fROCCurves; std::vector fSigs; From 612bef32026c136cbd03bb4157cc5e5994a00e40 Mon Sep 17 00:00:00 2001 From: John Harvey Date: Fri, 17 Mar 2017 17:38:55 +0100 Subject: [PATCH 22/54] coverity 68855 --- tmva/tmva/inc/TMVA/LossFunction.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tmva/tmva/inc/TMVA/LossFunction.h b/tmva/tmva/inc/TMVA/LossFunction.h index 71604115325b7..0f5d33c3e2c19 100644 --- a/tmva/tmva/inc/TMVA/LossFunction.h +++ b/tmva/tmva/inc/TMVA/LossFunction.h @@ -46,7 +46,11 @@ namespace TMVA { class LossFunctionEventInfo{ public: - LossFunctionEventInfo(){}; + LossFunctionEventInfo(){ + trueValue = 0.; + predictedValue = 0.; + weight = 0.; + }; LossFunctionEventInfo(Double_t trueValue_, Double_t predictedValue_, Double_t weight_){ trueValue = trueValue_; predictedValue = predictedValue_; From d0c3af7ea41a88780b9edba92eba40b65a97d9a3 Mon Sep 17 00:00:00 2001 From: John Harvey Date: Fri, 17 Mar 2017 17:40:59 +0100 Subject: [PATCH 23/54] coverity 68962 --- tmva/tmva/inc/TMVA/VariableImportance.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tmva/tmva/inc/TMVA/VariableImportance.h b/tmva/tmva/inc/TMVA/VariableImportance.h index 4c41d240631ae..d82d99d839130 100644 --- a/tmva/tmva/inc/TMVA/VariableImportance.h +++ b/tmva/tmva/inc/TMVA/VariableImportance.h @@ -28,7 +28,7 @@ namespace TMVA { private: OptionMap fImportanceValues; std::shared_ptr fImportanceHist; - VIType fType; + VIType fType {kShort}; public: VariableImportanceResult(); VariableImportanceResult(const VariableImportanceResult &); @@ -44,9 +44,9 @@ namespace TMVA { class VariableImportance : public Envelope { private: - UInt_t fNumFolds; + UInt_t fNumFolds = 0; VariableImportanceResult fResults; - VIType fType; + VIType fType {kShort}; public: explicit VariableImportance(DataLoader *loader); ~VariableImportance(); From 66941837b05bfad36a93e9cecf3b27e6c178cbd8 Mon Sep 17 00:00:00 2001 From: John Harvey Date: Fri, 17 Mar 2017 17:43:05 +0100 Subject: [PATCH 24/54] coverity 68958 --- tmva/tmva/src/DataLoader.cxx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tmva/tmva/src/DataLoader.cxx b/tmva/tmva/src/DataLoader.cxx index 75d5db90fdccb..65667ebbab724 100644 --- a/tmva/tmva/src/DataLoader.cxx +++ b/tmva/tmva/src/DataLoader.cxx @@ -176,11 +176,13 @@ TMVA::DataLoader* TMVA::DataLoader::VarTransform(TString trafoDefinition) Double_t threshold = 0.0; if (!trOptions.IsFloat()){ Log() << kFATAL << " VT transformation must be passed a floating threshold value" << Endl; + delete handler; return this; } else threshold = trOptions.Atof(); TMVA::DataLoader *transformedLoader = handler->VarianceThreshold(threshold); + delete handler; return transformedLoader; } else { @@ -685,7 +687,7 @@ void TMVA::DataLoader::MakeKFoldDataSet(UInt_t numberFolds, bool validationSet){ if( strncmp( DefaultDataSetInfo().GetClassInfo( TestingData.at(i)->GetClass() )->GetName(), "Signal", 6) == 0){ TestSigData.push_back(TestingData.at(i)); } else if( strncmp( DefaultDataSetInfo().GetClassInfo( TestingData.at(i)->GetClass() )->GetName(), "Background", 10) == 0){ TestBkgData.push_back(TestingData.at(i)); } else{ - Log() << kFATAL << "DataSets should only contain Signal and Background classes for classification, " << DefaultDataSetInfo().GetClassInfo( TrainingData.at(i)->GetClass() )->GetName() << " is not a recognised class" << Endl; + Log() << kFATAL << "DataSets should only contain Signal and Background classes for classification, " << DefaultDataSetInfo().GetClassInfo( TestingData.at(i)->GetClass() )->GetName() << " is not a recognised class" << Endl; } } @@ -796,7 +798,8 @@ void TMVA::DataLoader::PrepareFoldDataSet(UInt_t foldNumber, Types::ETreeType tt // Assign the vectors of the events to rebuild the dataset DefaultDataSetInfo().GetDataSet()->SetEventCollection(tempTrain,Types::kTraining,false); DefaultDataSetInfo().GetDataSet()->SetEventCollection(tempTest,Types::kTesting,false); - + delete tempTest; + delete tempTrain; } //////////////////////////////////////////////////////////////////////////////// From bb1601830b47c76fdc4d1648cc9e29a3cf57f61e Mon Sep 17 00:00:00 2001 From: John Harvey Date: Fri, 17 Mar 2017 17:45:07 +0100 Subject: [PATCH 25/54] coverity 68731,68730,68729 --- tmva/tmva/src/DataSetFactory.cxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tmva/tmva/src/DataSetFactory.cxx b/tmva/tmva/src/DataSetFactory.cxx index 999ae08999166..e5d3d0f0ec97e 100644 --- a/tmva/tmva/src/DataSetFactory.cxx +++ b/tmva/tmva/src/DataSetFactory.cxx @@ -182,7 +182,8 @@ TMVA::DataSet* TMVA::DataSetFactory::BuildDynamicDataSet( TMVA::DataSetInfo& dsi ds->SetEventCollection(newEventVector, Types::kTraining); ds->SetCurrentType( Types::kTraining ); ds->SetCurrentEvent( 0 ); - + + delete newEventVector; return ds; } @@ -1398,7 +1399,8 @@ TMVA::DataSetFactory::MixEvents( DataSetInfo& dsi, Log() << kERROR << "Dataset " << std::string(dsi.GetName()) << " does not have any testing events, guess that will cause problems later..but for now, I continue " << Endl; } - + delete trainingEventVector; + delete testingEventVector; return ds; } From 590085e1f18cfa87623e0c669501072347f7dba8 Mon Sep 17 00:00:00 2001 From: John Harvey Date: Fri, 17 Mar 2017 17:46:35 +0100 Subject: [PATCH 26/54] coverity 68959 --- tmva/tmva/src/Envelope.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/tmva/tmva/src/Envelope.cxx b/tmva/tmva/src/Envelope.cxx index a764c16d23755..e54c27512e0ad 100644 --- a/tmva/tmva/src/Envelope.cxx +++ b/tmva/tmva/src/Envelope.cxx @@ -32,6 +32,7 @@ using namespace TMVA; Envelope::Envelope(const TString &name,DataLoader *dalaloader,TFile *file,const TString options):Configurable(options),fDataLoader(dalaloader),fFile(file),fVerbose(kFALSE) { SetName(name.Data()); + fModelPersistence = kTRUE; } //////////////////////////////////////////////////////////////////////////////// From c41182a261324ee8a4fbe15aa9100b115dad53ed Mon Sep 17 00:00:00 2001 From: John Harvey Date: Fri, 17 Mar 2017 17:51:12 +0100 Subject: [PATCH 27/54] coverity 68856 --- tmva/tmva/src/HyperParameterOptimisation.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/tmva/tmva/src/HyperParameterOptimisation.cxx b/tmva/tmva/src/HyperParameterOptimisation.cxx index 21f9e9f6d45d2..0090cdcbed043 100644 --- a/tmva/tmva/src/HyperParameterOptimisation.cxx +++ b/tmva/tmva/src/HyperParameterOptimisation.cxx @@ -30,6 +30,7 @@ TMVA::HyperParameterOptimisationResult::HyperParameterOptimisationResult():fROCCurves(new TMultiGraph()) { + fROCAVG = 0.; } TMVA::HyperParameterOptimisationResult::~HyperParameterOptimisationResult() From bb0c89765b0267c1080c7407dd79f7dce009fc90 Mon Sep 17 00:00:00 2001 From: John Harvey Date: Fri, 17 Mar 2017 17:54:44 +0100 Subject: [PATCH 28/54] coverity 68080 --- tmva/tmva/src/MethodBDT.cxx | 2 ++ tmva/tmva/src/MethodBoost.cxx | 2 ++ 2 files changed, 4 insertions(+) diff --git a/tmva/tmva/src/MethodBDT.cxx b/tmva/tmva/src/MethodBDT.cxx index 93234d413266b..04a86567dc390 100644 --- a/tmva/tmva/src/MethodBDT.cxx +++ b/tmva/tmva/src/MethodBDT.cxx @@ -213,6 +213,7 @@ TMVA::MethodBDT::MethodBDT( const TString& jobName, { fMonitorNtuple = NULL; fSepType = NULL; + fRegressionLossFunctionBDTG = nullptr; } //////////////////////////////////////////////////////////////////////////////// @@ -267,6 +268,7 @@ TMVA::MethodBDT::MethodBDT( DataSetInfo& theData, { fMonitorNtuple = NULL; fSepType = NULL; + fRegressionLossFunctionBDTG = nullptr; // constructor for calculating BDT-MVA using previously generated decision trees // the result of the previous training (the decision trees) are read in via the // weight file. Make sure the the variables correspond to the ones used in diff --git a/tmva/tmva/src/MethodBoost.cxx b/tmva/tmva/src/MethodBoost.cxx index 218497d2f6824..21a4f0810bc6f 100644 --- a/tmva/tmva/src/MethodBoost.cxx +++ b/tmva/tmva/src/MethodBoost.cxx @@ -137,6 +137,8 @@ TMVA::MethodBoost::MethodBoost( DataSetInfo& dsi, , fMVAvalues(0) { fMVAvalues = new std::vector; + fDataSetManager = NULL; + fHistoricBoolOption = kFALSE; } //////////////////////////////////////////////////////////////////////////////// From 4cdb9dba0d340c874e00b4dd52e995e379ab6622 Mon Sep 17 00:00:00 2001 From: John Harvey Date: Fri, 17 Mar 2017 17:57:03 +0100 Subject: [PATCH 29/54] coverity 68083 --- tmva/tmva/src/MethodDNN.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tmva/tmva/src/MethodDNN.cxx b/tmva/tmva/src/MethodDNN.cxx index 84fcca6649961..f2a34965f97f0 100644 --- a/tmva/tmva/src/MethodDNN.cxx +++ b/tmva/tmva/src/MethodDNN.cxx @@ -95,6 +95,8 @@ TMVA::MethodDNN::MethodDNN(DataSetInfo& theData, fTrainingStrategyString(), fWeightInitializationString(), fArchitectureString(), fTrainingSettings(), fResume(false), fSettings() { + fWeightInitialization = DNN::EInitialization::kGauss; + fOutputFunction = DNN::EOutputFunction::kSigmoid; } //////////////////////////////////////////////////////////////////////////////// @@ -102,7 +104,8 @@ TMVA::MethodDNN::MethodDNN(DataSetInfo& theData, TMVA::MethodDNN::~MethodDNN() { - // nothing to be done + fWeightInitialization = DNN::EInitialization::kGauss; + fOutputFunction = DNN::EOutputFunction::kSigmoid; } //////////////////////////////////////////////////////////////////////////////// From a28cb14f2dc632fff165996c317037a909851722 Mon Sep 17 00:00:00 2001 From: John Harvey Date: Fri, 17 Mar 2017 18:00:23 +0100 Subject: [PATCH 30/54] coverity 68079,68078,68077 --- tmva/tmva/src/MethodDT.cxx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tmva/tmva/src/MethodDT.cxx b/tmva/tmva/src/MethodDT.cxx index 85df5f82f7b86..7694b3669c44a 100644 --- a/tmva/tmva/src/MethodDT.cxx +++ b/tmva/tmva/src/MethodDT.cxx @@ -148,6 +148,7 @@ ClassImp(TMVA::MethodDT) , fUsePoissonNvars(0) // don't use this initialisation, only here to make Coverity happy. Is set in Init() , fDeltaPruneStrength(0) { + fPruneBeforeBoost = kFALSE; } //////////////////////////////////////////////////////////////////////////////// @@ -172,6 +173,7 @@ TMVA::MethodDT::MethodDT( DataSetInfo& dsi, , fUseNvars(0) , fDeltaPruneStrength(0) { + fPruneBeforeBoost = kFALSE; } //////////////////////////////////////////////////////////////////////////////// From b479b9d0d5469727ab65d0faf081fe94d5c3ffd1 Mon Sep 17 00:00:00 2001 From: John Harvey Date: Fri, 17 Mar 2017 18:02:28 +0100 Subject: [PATCH 31/54] coverity 68749 --- tmva/tmva/src/Tools.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmva/tmva/src/Tools.cxx b/tmva/tmva/src/Tools.cxx index fdb91e609e261..9a2f70544c174 100644 --- a/tmva/tmva/src/Tools.cxx +++ b/tmva/tmva/src/Tools.cxx @@ -367,8 +367,8 @@ const TMatrixD* TMVA::Tools::GetCorrelationMatrix( const TMatrixD* covMat ) else (*corrMat)(ivar, ivar) = 1.0; } } - return corrMat; Log() << Endl; + return corrMat; } //////////////////////////////////////////////////////////////////////////////// From f9f5674a650a47e4a4b22503ee0750dbbce6e8ce Mon Sep 17 00:00:00 2001 From: John Harvey Date: Fri, 17 Mar 2017 18:29:26 +0100 Subject: [PATCH 32/54] reverting to original version of llvm code --- .../src/lib/Transforms/Instrumentation/EfficiencySanitizer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interpreter/llvm/src/lib/Transforms/Instrumentation/EfficiencySanitizer.cpp b/interpreter/llvm/src/lib/Transforms/Instrumentation/EfficiencySanitizer.cpp index e47ef83c425a1..6640e7b54bd77 100644 --- a/interpreter/llvm/src/lib/Transforms/Instrumentation/EfficiencySanitizer.cpp +++ b/interpreter/llvm/src/lib/Transforms/Instrumentation/EfficiencySanitizer.cpp @@ -716,7 +716,7 @@ bool EfficiencySanitizer::instrumentGetElementPtr(Instruction *I, Module &M) { return false; } Type *SourceTy = GepInst->getSourceElementType(); - StructType *StructTy = nullptr; + StructType *StructTy; ConstantInt *Idx; // Check if GEP calculates address from a struct array. if (isa(SourceTy)) { From 1b853769dd2d2c1f566b33bcd47fb3a41705c0c1 Mon Sep 17 00:00:00 2001 From: John Harvey Date: Wed, 5 Apr 2017 15:33:07 +0200 Subject: [PATCH 33/54] coverity 68722: check result of dynamic cast in stressTMVA --- test/stressTMVA.cxx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/test/stressTMVA.cxx b/test/stressTMVA.cxx index 268fb461d74ad..435e3332b512c 100644 --- a/test/stressTMVA.cxx +++ b/test/stressTMVA.cxx @@ -1583,8 +1583,10 @@ bool utFactory::addEventsToFactoryByHand(const char* factoryname, const char* op factory->TrainAllMethods(); factory->TestAllMethods(); factory->EvaluateAllMethods(); - MethodBase* theMethod = dynamic_cast (factory->GetMethod(dataloader->GetName(), _methodTitle)); - double ROCValue = theMethod->GetROCIntegral(); + double ROCValue(0.); + if (auto theMethod = dynamic_cast (factory->GetMethod(dataloader->GetName(), _methodTitle))) { + ROCValue = theMethod->GetROCIntegral(); + } //cout << "ROC="<TrainAllMethods(); factory->TestAllMethods(); factory->EvaluateAllMethods(); - MethodBase* theMethod = dynamic_cast (factory->GetMethod(dataloader->GetName(), _methodTitle)); - double ROCValue = theMethod->GetROCIntegral(); + double ROCValue(0.); + if (auto theMethod = dynamic_cast (factory->GetMethod(dataloader->GetName(), _methodTitle))){ + ROCValue = theMethod->GetROCIntegral(); + } delete tree; delete dataloader; delete factory; From af624e1c95b7e9a2e827d0b5e0ef638d5b3dcf10 Mon Sep 17 00:00:00 2001 From: John Harvey Date: Wed, 5 Apr 2017 15:49:49 +0200 Subject: [PATCH 34/54] coverity 68720 : check result of dynamic cast in TH1Merger --- hist/hist/src/TH1Merger.cxx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/hist/hist/src/TH1Merger.cxx b/hist/hist/src/TH1Merger.cxx index ce4076b776e6a..b26795cfc82d6 100644 --- a/hist/hist/src/TH1Merger.cxx +++ b/hist/hist/src/TH1Merger.cxx @@ -389,10 +389,11 @@ Bool_t TH1Merger::BufferMerge() { h2->Fill(hist->fBuffer[3*i + 2], hist->fBuffer[3*i + 3],hist->fBuffer[3*i + 1] ); } if (fH0->fDimension == 3) { - auto h3 = dynamic_cast(fH0); - R__ASSERT(h3); - for (Int_t i = 0; i < nbentries; i++) - h3->Fill(hist->fBuffer[4*i + 2], hist->fBuffer[4*i + 3],hist->fBuffer[4*i + 4], hist->fBuffer[4*i + 1] ); + if (auto h3 = dynamic_cast(fH0)){ + R__ASSERT(h3); + for (Int_t i = 0; i < nbentries; i++) + h3->Fill(hist->fBuffer[4*i + 2], hist->fBuffer[4*i + 3],hist->fBuffer[4*i + 4], hist->fBuffer[4*i + 1] ); + } } fInputList.Remove(hist); } From b16d55cfc3a52920d05463fc1240d73870e527c8 Mon Sep 17 00:00:00 2001 From: John Harvey Date: Wed, 5 Apr 2017 16:06:32 +0200 Subject: [PATCH 35/54] coverity 68719: check result of dynamic cast in TH1Merger --- hist/hist/src/TH1Merger.cxx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/hist/hist/src/TH1Merger.cxx b/hist/hist/src/TH1Merger.cxx index b26795cfc82d6..2801f9fb00c26 100644 --- a/hist/hist/src/TH1Merger.cxx +++ b/hist/hist/src/TH1Merger.cxx @@ -383,10 +383,11 @@ Bool_t TH1Merger::BufferMerge() { fH0->Fill(hist->fBuffer[2*i + 2], hist->fBuffer[2*i + 1]); } if (fH0->fDimension == 2) { - auto h2 = dynamic_cast(fH0); - R__ASSERT(h2); - for (Int_t i = 0; i < nbentries; i++) - h2->Fill(hist->fBuffer[3*i + 2], hist->fBuffer[3*i + 3],hist->fBuffer[3*i + 1] ); + if (auto h2 = dynamic_cast(fH0)){ + R__ASSERT(h2); + for (Int_t i = 0; i < nbentries; i++) + h2->Fill(hist->fBuffer[3*i + 2], hist->fBuffer[3*i + 3],hist->fBuffer[3*i + 1] ); + } } if (fH0->fDimension == 3) { if (auto h3 = dynamic_cast(fH0)){ From cac9d167866822158ffb91386bf6bcad1c090bfc Mon Sep 17 00:00:00 2001 From: John Harvey Date: Wed, 5 Apr 2017 16:15:38 +0200 Subject: [PATCH 36/54] coverity 63257: uninitialised scalar field in GSLMultiFitFunctionWrapper --- math/mathmore/src/GSLMultiFitFunctionWrapper.h | 1 + 1 file changed, 1 insertion(+) diff --git a/math/mathmore/src/GSLMultiFitFunctionWrapper.h b/math/mathmore/src/GSLMultiFitFunctionWrapper.h index c38fd98574f5c..833f1a7801723 100644 --- a/math/mathmore/src/GSLMultiFitFunctionWrapper.h +++ b/math/mathmore/src/GSLMultiFitFunctionWrapper.h @@ -68,6 +68,7 @@ class GSLMultiFitFunctionWrapper { fFunc.p = 0; fFunc.params = 0; fFunc.nevalf = 0; + fFunc.nevaldf = 0; } From 6575e9ac220edb7f53a08ef3234b4ac4d17f68da Mon Sep 17 00:00:00 2001 From: John Harvey Date: Wed, 5 Apr 2017 16:38:06 +0200 Subject: [PATCH 37/54] coverity 623121 and 62311: uninitialised array elements --- math/mathmore/test/testInterpolation.cxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/math/mathmore/test/testInterpolation.cxx b/math/mathmore/test/testInterpolation.cxx index 5abcc586e975c..a439e3b42f494 100644 --- a/math/mathmore/test/testInterpolation.cxx +++ b/math/mathmore/test/testInterpolation.cxx @@ -29,10 +29,12 @@ void interpolate( const ROOT::Math::Interpolator & itp, bool drawSame = false ) std::cout << "x[i] y[i] deriv[i] deriv2[i] integral[i] \n" << std::endl; // print result of interpolation - const Int_t n = 51; + const Int_t n = 50; Int_t i = 0; + double xi =0.; Float_t xcoord[n], ycoord[n]; - for ( double xi = 0; xi < 10.01; xi += 0.2) { + for ( i = 0; i < 50; ++i) { + xi = 0.2*i; xcoord[i] = xi; ycoord[i] = itp.Eval(xi); double dyi = itp.Deriv(xi); From 24e88e08c2421a282f138463e691c5f085d38509 Mon Sep 17 00:00:00 2001 From: John Harvey Date: Wed, 5 Apr 2017 17:09:48 +0200 Subject: [PATCH 38/54] coverity 62241,42,51,68: fixed 4 memory leaks in testGSLRootFinder --- math/mathmore/test/testGSLRootFinder.cxx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/math/mathmore/test/testGSLRootFinder.cxx b/math/mathmore/test/testGSLRootFinder.cxx index cb8bb343f150f..b79fc3e34a4bf 100644 --- a/math/mathmore/test/testGSLRootFinder.cxx +++ b/math/mathmore/test/testGSLRootFinder.cxx @@ -167,9 +167,15 @@ int testGSLRootFinder() { } timer.Stop(); status += printStats(rf6, returnCode, timer); - + delete rf1; + rf1 = nullptr; + delete rf2; + rf2 = nullptr; + delete rf3; + rf3 = nullptr; + delete rf4; + rf4 = nullptr; return status; - } int main() { From c6d9e5868f26d91993740d94dc11883b314e47b9 Mon Sep 17 00:00:00 2001 From: Pere Mato Date: Wed, 5 Apr 2017 22:59:30 +0200 Subject: [PATCH 39/54] Update testInterpolation.cxx --- math/mathmore/test/testInterpolation.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/math/mathmore/test/testInterpolation.cxx b/math/mathmore/test/testInterpolation.cxx index f58f509b3a7bb..e5a7cb6e15f68 100644 --- a/math/mathmore/test/testInterpolation.cxx +++ b/math/mathmore/test/testInterpolation.cxx @@ -31,11 +31,11 @@ void interpolate( const ROOT::Math::Interpolator & itp, bool drawSame = false ) // print result of interpolation const Int_t n = 50; Int_t i = 0; - double xi =0.; + double xi = 0.; Float_t xcoord[n], ycoord[n]; - for ( i = 0; i < 50; ++i) { - xi = 0.2*i; + for (i = 0; i < 50; ++i) { + xi = 0.2 * i; xcoord[i] = xi; ycoord[i] = itp.Eval(xi); double dyi = itp.Deriv(xi); From 4b5eb01e39fa4a9e32a7ebf9ea0da6a0c078c1b1 Mon Sep 17 00:00:00 2001 From: Pere Mato Date: Wed, 5 Apr 2017 23:01:48 +0200 Subject: [PATCH 40/54] Update stressTMVA.cxx --- test/stressTMVA.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/stressTMVA.cxx b/test/stressTMVA.cxx index 435e3332b512c..7aac18943beb9 100644 --- a/test/stressTMVA.cxx +++ b/test/stressTMVA.cxx @@ -1584,8 +1584,8 @@ bool utFactory::addEventsToFactoryByHand(const char* factoryname, const char* op factory->TestAllMethods(); factory->EvaluateAllMethods(); double ROCValue(0.); - if (auto theMethod = dynamic_cast (factory->GetMethod(dataloader->GetName(), _methodTitle))) { - ROCValue = theMethod->GetROCIntegral(); + if (auto theMethod = dynamic_cast(factory->GetMethod(dataloader->GetName(), _methodTitle))) { + ROCValue = theMethod->GetROCIntegral(); } //cout << "ROC="<TestAllMethods(); factory->EvaluateAllMethods(); double ROCValue(0.); - if (auto theMethod = dynamic_cast (factory->GetMethod(dataloader->GetName(), _methodTitle))){ + if (auto theMethod = dynamic_cast(factory->GetMethod(dataloader->GetName(), _methodTitle))){ ROCValue = theMethod->GetROCIntegral(); } delete tree; From 236ac4002d596f7651c8656c69f5c578fa2ca728 Mon Sep 17 00:00:00 2001 From: Pere Mato Date: Wed, 5 Apr 2017 23:11:41 +0200 Subject: [PATCH 41/54] Update testInterpolation.cxx --- math/mathmore/test/testInterpolation.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/math/mathmore/test/testInterpolation.cxx b/math/mathmore/test/testInterpolation.cxx index e5a7cb6e15f68..703591d8b49b8 100644 --- a/math/mathmore/test/testInterpolation.cxx +++ b/math/mathmore/test/testInterpolation.cxx @@ -34,7 +34,7 @@ void interpolate( const ROOT::Math::Interpolator & itp, bool drawSame = false ) double xi = 0.; Float_t xcoord[n], ycoord[n]; - for (i = 0; i < 50; ++i) { + for (i = 0; i < 50; ++i) { xi = 0.2 * i; xcoord[i] = xi; ycoord[i] = itp.Eval(xi); From f6a5aca6c511c0ccf4cff2a177b39c9774d13456 Mon Sep 17 00:00:00 2001 From: Pere Mato Date: Wed, 5 Apr 2017 23:12:16 +0200 Subject: [PATCH 42/54] Update stressTMVA.cxx --- test/stressTMVA.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/stressTMVA.cxx b/test/stressTMVA.cxx index 7aac18943beb9..bde8f16af3552 100644 --- a/test/stressTMVA.cxx +++ b/test/stressTMVA.cxx @@ -1646,7 +1646,7 @@ bool utFactory::operateSingleFactory(const char* factoryname, const char* opt) factory->TestAllMethods(); factory->EvaluateAllMethods(); double ROCValue(0.); - if (auto theMethod = dynamic_cast(factory->GetMethod(dataloader->GetName(), _methodTitle))){ + if (auto theMethod = dynamic_cast(factory->GetMethod(dataloader->GetName(), _methodTitle))) { ROCValue = theMethod->GetROCIntegral(); } delete tree; From ff168373eabd6bcb8f3d13010a96eb15ab1561f6 Mon Sep 17 00:00:00 2001 From: John Harvey Date: Fri, 7 Apr 2017 11:37:55 +0200 Subject: [PATCH 43/54] coverity bug fix --- math/mathmore/test/testDerivation.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/math/mathmore/test/testDerivation.cxx b/math/mathmore/test/testDerivation.cxx index 591060d5e27d2..1788d59dc37c2 100644 --- a/math/mathmore/test/testDerivation.cxx +++ b/math/mathmore/test/testDerivation.cxx @@ -118,7 +118,8 @@ int testDerivation() { // WrappedFunc fy(*f2d,0,vx); // std::cout << "df/dy = " << der->EvalCentral(fy,2.) << std::endl; // #endif - + delete der; //fix memory leak + der = nullptr; return status; } From 04fae886ad4210514d0b0b4d880d010447b09bf8 Mon Sep 17 00:00:00 2001 From: John Harvey Date: Fri, 7 Apr 2017 14:31:41 +0200 Subject: [PATCH 44/54] reverting to original file after fix in R__ASSERT --- hist/hist/src/TH1Merger.cxx | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/hist/hist/src/TH1Merger.cxx b/hist/hist/src/TH1Merger.cxx index 2801f9fb00c26..92c78a57d9f1c 100644 --- a/hist/hist/src/TH1Merger.cxx +++ b/hist/hist/src/TH1Merger.cxx @@ -383,18 +383,16 @@ Bool_t TH1Merger::BufferMerge() { fH0->Fill(hist->fBuffer[2*i + 2], hist->fBuffer[2*i + 1]); } if (fH0->fDimension == 2) { - if (auto h2 = dynamic_cast(fH0)){ - R__ASSERT(h2); - for (Int_t i = 0; i < nbentries; i++) - h2->Fill(hist->fBuffer[3*i + 2], hist->fBuffer[3*i + 3],hist->fBuffer[3*i + 1] ); - } + auto h2 = dynamic_cast(fH0); + R__ASSERT(h2); + for (Int_t i = 0; i < nbentries; i++) + h2->Fill(hist->fBuffer[3*i + 2], hist->fBuffer[3*i + 3],hist->fBuffer[3*i + 1] ); } if (fH0->fDimension == 3) { - if (auto h3 = dynamic_cast(fH0)){ - R__ASSERT(h3); - for (Int_t i = 0; i < nbentries; i++) - h3->Fill(hist->fBuffer[4*i + 2], hist->fBuffer[4*i + 3],hist->fBuffer[4*i + 4], hist->fBuffer[4*i + 1] ); - } + auto h3 = dynamic_cast(fH0); + R__ASSERT(h3); + for (Int_t i = 0; i < nbentries; i++) + h3->Fill(hist->fBuffer[4*i + 2], hist->fBuffer[4*i + 3],hist->fBuffer[4*i + 4], hist->fBuffer[4*i + 1] ); } fInputList.Remove(hist); } From ccb3ec6b9a20659b118d3ba1150f14a1ab586bf5 Mon Sep 17 00:00:00 2001 From: John Harvey Date: Fri, 7 Apr 2017 15:09:49 +0200 Subject: [PATCH 45/54] ignore MacOS specific .DS_Store --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 0065262e93d91..631ff0fbb1425 100644 --- a/.gitignore +++ b/.gitignore @@ -26,6 +26,9 @@ etc/allDict.h xcuserdata project.xcworkspace +# MacOS metadata +.DS_Store + # Visual Code .vscode/* From c0cf7325b41500b1db2599ba75b3b83a6e36ada1 Mon Sep 17 00:00:00 2001 From: John Harvey Date: Fri, 7 Apr 2017 16:51:12 +0200 Subject: [PATCH 46/54] coverity 94173: memory leak pointer libRIOHandler --- core/base/src/TROOT.cxx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/base/src/TROOT.cxx b/core/base/src/TROOT.cxx index 10c9dad4d07ef..b526aabf3fdbe 100644 --- a/core/base/src/TROOT.cxx +++ b/core/base/src/TROOT.cxx @@ -1934,6 +1934,8 @@ void TROOT::InitInterpreter() fprintf(stderr, "Fatal in : cannot load library %s\n", err.Data()); exit(1); } + delete libRIOHandle; + libRIOHandle = nullptr; dlerror(); // reset error message } else { gInterpreterLib = RTLD_DEFAULT; From 35a4f25552f4b1df94c3a2c6fb053019a8029840 Mon Sep 17 00:00:00 2001 From: John Harvey Date: Fri, 7 Apr 2017 16:52:19 +0200 Subject: [PATCH 47/54] coverity 61562: memory leak pointer vars --- test/TFormulaTests.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/test/TFormulaTests.cxx b/test/TFormulaTests.cxx index ca4fd1d18d688..1cf37cd3f05e2 100644 --- a/test/TFormulaTests.cxx +++ b/test/TFormulaTests.cxx @@ -184,6 +184,7 @@ Bool_t TFormulaTests::SetVars() successful = false; } } + delete vars; return successful; } From c469a013287233cfdca77f9b8974a2cd31b98c59 Mon Sep 17 00:00:00 2001 From: John Harvey Date: Fri, 7 Apr 2017 16:52:55 +0200 Subject: [PATCH 48/54] memory leak variable c --- tmva/tmvagui/src/rulevisHists.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/tmva/tmvagui/src/rulevisHists.cxx b/tmva/tmvagui/src/rulevisHists.cxx index d397e7c10594f..d168ce0a3bfd2 100644 --- a/tmva/tmvagui/src/rulevisHists.cxx +++ b/tmva/tmvagui/src/rulevisHists.cxx @@ -174,6 +174,7 @@ void TMVA::rulevisHists( TDirectory *rfdir, TDirectory *vardir, TDirectory *corr if (bgd == NULL) { cout << "ERROR!!! couldn't find backgroung histo for" << hname << endl; //exit(1); + delete c; return; } From 4fcdc324ba46a9a697126bae2939b2ca7b8b8c71 Mon Sep 17 00:00:00 2001 From: John Harvey Date: Fri, 7 Apr 2017 17:29:20 +0200 Subject: [PATCH 49/54] Revert "coverity 94173: memory leak pointer libRIOHandler" This reverts commit c0cf7325b41500b1db2599ba75b3b83a6e36ada1. --- core/base/src/TROOT.cxx | 2 -- 1 file changed, 2 deletions(-) diff --git a/core/base/src/TROOT.cxx b/core/base/src/TROOT.cxx index b526aabf3fdbe..10c9dad4d07ef 100644 --- a/core/base/src/TROOT.cxx +++ b/core/base/src/TROOT.cxx @@ -1934,8 +1934,6 @@ void TROOT::InitInterpreter() fprintf(stderr, "Fatal in : cannot load library %s\n", err.Data()); exit(1); } - delete libRIOHandle; - libRIOHandle = nullptr; dlerror(); // reset error message } else { gInterpreterLib = RTLD_DEFAULT; From 0d10d01477f18c7695d60b1833411f42fee97c0c Mon Sep 17 00:00:00 2001 From: John Harvey Date: Fri, 7 Apr 2017 18:02:30 +0200 Subject: [PATCH 50/54] coverity 61577: re-fix of memory link using delete [] c --- tmva/tmvagui/src/rulevisHists.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmva/tmvagui/src/rulevisHists.cxx b/tmva/tmvagui/src/rulevisHists.cxx index d168ce0a3bfd2..1edd521d1143d 100644 --- a/tmva/tmvagui/src/rulevisHists.cxx +++ b/tmva/tmvagui/src/rulevisHists.cxx @@ -174,7 +174,7 @@ void TMVA::rulevisHists( TDirectory *rfdir, TDirectory *vardir, TDirectory *corr if (bgd == NULL) { cout << "ERROR!!! couldn't find backgroung histo for" << hname << endl; //exit(1); - delete c; + delete [] c; return; } From 1bfbde87cd257d15932750f9fca069e35622c440 Mon Sep 17 00:00:00 2001 From: Pere Mato Date: Sun, 9 Apr 2017 20:03:59 +0200 Subject: [PATCH 51/54] Update TFormulaTests.cxx Fix warning --- test/TFormulaTests.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/TFormulaTests.cxx b/test/TFormulaTests.cxx index 1cf37cd3f05e2..a42b041027dd3 100644 --- a/test/TFormulaTests.cxx +++ b/test/TFormulaTests.cxx @@ -184,7 +184,7 @@ Bool_t TFormulaTests::SetVars() successful = false; } } - delete vars; + delete[] vars; return successful; } From c627ce92488abd79705a9354915f89ee83ec335f Mon Sep 17 00:00:00 2001 From: John Harvey Date: Wed, 12 Apr 2017 15:39:27 +0200 Subject: [PATCH 52/54] removed duplicate increment in for loop --- math/mathmore/test/testInterpolation.cxx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/math/mathmore/test/testInterpolation.cxx b/math/mathmore/test/testInterpolation.cxx index 920bdfb7c9c17..6c54cdbed1745 100644 --- a/math/mathmore/test/testInterpolation.cxx +++ b/math/mathmore/test/testInterpolation.cxx @@ -31,10 +31,9 @@ void interpolate( const ROOT::Math::Interpolator & itp, bool drawSame = false ) // print result of interpolation const Int_t n = 50; //JH replacing n = 51; Int_t i = 0; - double xi = 0.; Float_t xcoord[n], ycoord[n]; - for ( i = 0; i < 50; ++i) { + for ( i = 0; i < n; ++i) { xi = 0.2 * i; // JH replacing for ( double xi = 0; xi < 10.01; xi += 0.2) { xcoord[i] = xi; @@ -43,7 +42,7 @@ void interpolate( const ROOT::Math::Interpolator & itp, bool drawSame = false ) double dy2i = itp.Deriv2(xi); double igyi = itp.Integ(0, xi); std::cout << xcoord[i] << " " << ycoord[i] << " " << dyi << " " << dy2i << " " << igyi << std::endl; - i++; + //remove duplicate loop increment i++; } if (showGraphics) { From e815eaa10956d97d9fed1ff6a42060221336340e Mon Sep 17 00:00:00 2001 From: John Harvey Date: Tue, 25 Apr 2017 15:28:10 +0200 Subject: [PATCH 53/54] coverity 61279: fix copy/paste error --- test/stressLinear.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/stressLinear.cxx b/test/stressLinear.cxx index 4a198019277f3..a9160f403b8be 100644 --- a/test/stressLinear.cxx +++ b/test/stressLinear.cxx @@ -2249,7 +2249,7 @@ void spstress_matrix_fill(Int_t rsize,Int_t csize) { Bool_t ok = kTRUE; - if (csize < 4) { + if (rsize < 4) { Error("spstress_matrix_fill","rsize should be >= 4"); ok = kFALSE; StatusPrint(2,"Filling, Inserting, Using",ok); From 203703ff788092668e72c1dd38d64584512db29a Mon Sep 17 00:00:00 2001 From: John Harvey Date: Tue, 25 Apr 2017 16:36:33 +0200 Subject: [PATCH 54/54] coverity 61577: fix resource leak delete [] c --- tmva/tmvagui/src/rulevisHists.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/tmva/tmvagui/src/rulevisHists.cxx b/tmva/tmvagui/src/rulevisHists.cxx index 1edd521d1143d..6d1e33e0b3119 100644 --- a/tmva/tmvagui/src/rulevisHists.cxx +++ b/tmva/tmvagui/src/rulevisHists.cxx @@ -263,4 +263,5 @@ void TMVA::rulevisHists( TDirectory *rfdir, TDirectory *vardir, TDirectory *corr TString fname = Form( "plots/%s_c%i", outputName.Data(), countCanvas+1 ); TMVAGlob::imgconv( c[countCanvas], fname ); } + delete [] c; }