fix coverity defects
authorabercuci <abercuci@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 20 Dec 2010 10:05:12 +0000 (10:05 +0000)
committerabercuci <abercuci@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 20 Dec 2010 10:05:12 +0000 (10:05 +0000)
STAT/TKDInterpolatorBase.cxx
STAT/TKDNodeInfo.cxx

index ff847c9..b4a2cc4 100644 (file)
@@ -240,6 +240,8 @@ Double_t TKDInterpolatorBase::Eval(const Double_t *point, Double_t &result, Doub
       Error("TKDInterpolatorBase::Eval()", Form("Interpolation failed and number of interpolation points (%d) Can not be increased further.", npoints));
       result = 0.;
       error = 1.E10;
+      // clean memory
+      delete [] dist; delete [] index;
       return 0.;
     } else npoints = npoints_new;
     if(npoints > GetNTNodes()){
index 915a688..1a1fa74 100644 (file)
@@ -46,7 +46,7 @@ TKDNodeInfo::TKDNodeInfo(Int_t dim):
 //_________________________________________________________________
 TKDNodeInfo::TKDNodeInfo(const TKDNodeInfo &ref):
   TObject((TObject&) ref)
-  ,fNDim(fNDim)
+  ,fNDim(ref.fNDim)
   ,fData(NULL)
   ,fNpar(0)
   ,fNcov(0)
@@ -56,6 +56,7 @@ TKDNodeInfo::TKDNodeInfo(const TKDNodeInfo &ref):
   // Copy constructor
   Build(fNDim/3);
 
+  fData = new Float_t[fNDim];
   memcpy(fData, ref.fData, fNDim*sizeof(Float_t));
   fVal[0] = ref.fVal[0];
   fVal[1] = ref.fVal[1];