From 637c71b4476d3b86736d20a221841af3a9fb0808 Mon Sep 17 00:00:00 2001
From: Franck Dary <franck.dary@lis-lab.fr>
Date: Wed, 17 Jul 2019 14:08:19 +0200
Subject: [PATCH] Removed memory leak, it's ok now

---
 maca_common/include/LimitedStack.hpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/maca_common/include/LimitedStack.hpp b/maca_common/include/LimitedStack.hpp
index 4640038..048c4a4 100644
--- a/maca_common/include/LimitedStack.hpp
+++ b/maca_common/include/LimitedStack.hpp
@@ -57,6 +57,9 @@ class LimitedStack
       lastElementIndex = 0;
 
     present[data[lastElementIndex]]--;
+    if (present[data[lastElementIndex]] <= 0)
+      present.erase(present.find(data[lastElementIndex]));
+
     data[lastElementIndex] = elem;
     present[data[lastElementIndex]]++;
   }
-- 
GitLab