From 1dddd0df3a12dd22e6235e87b08c21560975748c Mon Sep 17 00:00:00 2001
From: "Dmitry Yu. Naumov" <github@naumov.de>
Date: Fri, 26 Jun 2015 00:32:19 +0000
Subject: [PATCH] [MGTL] Memory leak in HeuristicSearchLength.

---
 MeshGeoToolsLib/HeuristicSearchLength.cpp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/MeshGeoToolsLib/HeuristicSearchLength.cpp b/MeshGeoToolsLib/HeuristicSearchLength.cpp
index fc884a8c27a..e7e9a37169c 100644
--- a/MeshGeoToolsLib/HeuristicSearchLength.cpp
+++ b/MeshGeoToolsLib/HeuristicSearchLength.cpp
@@ -34,8 +34,9 @@ HeuristicSearchLength::HeuristicSearchLength(MeshLib::Mesh const& mesh, LengthTy
 				it != elements.cend(); ++it) {
 			std::size_t const n_edges((*it)->getNEdges());
 			for (std::size_t k(0); k<n_edges; k++) {
-				double const len =
-					static_cast<MeshLib::Line const*>((*it)->getEdge(k))->getContent();
+				auto edge = (*it)->getEdge(k);	// allocation inside getEdge().
+				double const len = edge->getContent();
+				delete edge;
 				sum += len;
 				sum_of_sqr += len*len;
 			}
-- 
GitLab