diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-04-01 02:14:59 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-04-01 02:14:59 +0400 |
commit | 2c0e32f4e4af6303c7215f2910b848937e2a3896 (patch) | |
tree | 1b82575206f9e75fa544e8218b43b158231c326e /source/blender/freestyle/intern | |
parent | 90b94fdce51e3061686c4481d42d3bd6b22f360d (diff) |
Fix for leak in freestyle FitCurve
Diffstat (limited to 'source/blender/freestyle/intern')
-rw-r--r-- | source/blender/freestyle/intern/geometry/FitCurve.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/source/blender/freestyle/intern/geometry/FitCurve.cpp b/source/blender/freestyle/intern/geometry/FitCurve.cpp index e517bf4f196..fbfa5b331e6 100644 --- a/source/blender/freestyle/intern/geometry/FitCurve.cpp +++ b/source/blender/freestyle/intern/geometry/FitCurve.cpp @@ -557,17 +557,20 @@ void FitCurveWrapper::FitCubic(Vector2 *d, int first, int last, Vector2 tHat1, V if (maxError < iterationError) { for (i = 0; i < maxIterations; i++) { uPrime = Reparameterize(d, first, last, u, bezCurve); - bezCurve = GenerateBezier(d, first, last, uPrime, tHat1, tHat2); - maxError = ComputeMaxError(d, first, last, - bezCurve, uPrime, &splitPoint); + + free((void *)u); + free((void *)bezCurve); + u = uPrime; + + bezCurve = GenerateBezier(d, first, last, u, tHat1, tHat2); + maxError = ComputeMaxError(d, first, last, bezCurve, u, &splitPoint); + if (maxError < error) { DrawBezierCurve(3, bezCurve); free((void *)u); free((void *)bezCurve); return; } - free((void *)u); - u = uPrime; } } |