From 40310658d26bf0351995ad9a2d7335016a13f3b4 Mon Sep 17 00:00:00 2001
From: Amaury Johnan <amjohnen@gmail.com>
Date: Thu, 6 Nov 2014 10:22:11 +0000
Subject: [PATCH] fix memory leak

---
 Numeric/MetricBasis.cpp | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/Numeric/MetricBasis.cpp b/Numeric/MetricBasis.cpp
index 868361a743..86a94a5948 100644
--- a/Numeric/MetricBasis.cpp
+++ b/Numeric/MetricBasis.cpp
@@ -157,12 +157,16 @@ double MetricBasis::getMinSampledR(MElement *el, int deg) const
   fullMatrix<double> R;
   interpolate(el, md, samplingPoints, R);
 
-  if (R.size1() < 1) return -1;
+  if (R.size1() < 1) {
+    delete md;
+    return -1;
+  }
 
   double min = R(0, 1);
   for (int i = 1; i < R.size1(); ++i)
     min = std::min(min, R(i, 1));
 
+  delete md;
   return min;
 }
 
@@ -891,6 +895,7 @@ void MetricBasis::interpolateAfterNSubdivisions(
 
   interpolate(el, md, subuvw, metric);
   bezierMapping->interpolate(nodes, subuvw, uvw, false);
+  delete md;
 }
 
 int MetricBasis::metricOrder(int tag)
-- 
GitLab