Skip to content

Commit

Permalink
Fix for ROOT-7672 and also fix a memory leak in TF1::Copy for non-for…
Browse files Browse the repository at this point in the history
…mula functions
  • Loading branch information
lmoneta committed Sep 29, 2015
1 parent 1f617d7 commit 5004c3d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions hist/hist/src/TF1.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,9 @@ TF1::TF1(const TF1 &f1) :
fNpfits(0), fNDF(0), fChisquare(0),
fMinimum(-1111), fMaximum(-1111),
fParent(0), fHistogram(0),
fMethodCall(0), fFormula(0), fParams(0)
fMethodCall(0),
fNormalized(false), fNormIntegral(0),
fFormula(0), fParams(0)
{
((TF1&)f1).Copy(*this);
}
Expand Down Expand Up @@ -760,6 +762,8 @@ void TF1::Copy(TObject &obj) const
((TF1&)obj).fSave = fSave;
((TF1&)obj).fHistogram = 0;
((TF1&)obj).fMethodCall = 0;
((TF1&)obj).fNormalized = fNormalized;
((TF1&)obj).fNormIntegral = fNormIntegral;
((TF1&)obj).fFormula = 0;

if (fFormula) assert(fFormula->GetNpar() == fNpar);
Expand All @@ -782,7 +786,7 @@ void TF1::Copy(TObject &obj) const
if (fParams) {
TF1Parameters * paramsToCopy = ((TF1&)obj).fParams;
if (paramsToCopy) *paramsToCopy = *fParams;
((TF1&)obj).fParams = new TF1Parameters(*fParams);
else ((TF1&)obj).fParams = new TF1Parameters(*fParams);
}
}

Expand Down

0 comments on commit 5004c3d

Please sign in to comment.