From 01018a0ed9e96f5a153ec5b1b6b29c940863ccb2 Mon Sep 17 00:00:00 2001
From: Jonathan Lambrechts <jonathan.lambrechts@uclouvain.be>
Date: Wed, 21 Apr 2010 07:40:41 +0000
Subject: [PATCH] remove a few minor memory leaks

---
 Mesh/Field.cpp | 4 ++++
 Mesh/Field.h   | 1 +
 2 files changed, 5 insertions(+)

diff --git a/Mesh/Field.cpp b/Mesh/Field.cpp
index eab297934d..61c6dd731a 100644
--- a/Mesh/Field.cpp
+++ b/Mesh/Field.cpp
@@ -1393,6 +1393,10 @@ FieldManager::FieldManager()
   map_type_name["MaxEigenHessian"] = new FieldFactoryT<MaxEigenHessianField>();
   background_field = -1;
 }
+FieldManager::~FieldManager(){
+  for ( std::map<std::string, FieldFactory*>::iterator it = map_type_name.begin(); it!=map_type_name.end(); it++)
+    delete it->second;
+}
 
 #if defined(HAVE_POST)
 void Field::putOnNewView()
diff --git a/Mesh/Field.h b/Mesh/Field.h
index c920d42bdf..e4eaf0001b 100644
--- a/Mesh/Field.h
+++ b/Mesh/Field.h
@@ -94,6 +94,7 @@ class FieldManager : public std::map<int, Field*> {
   int newId();
   int maxId();
   FieldManager();
+  ~FieldManager();
   int background_field;
   // compatibility with -bgm
   void setBackgroundMesh(int iView);
-- 
GitLab