diff --git a/lib/config/expression.hpp b/lib/config/expression.hpp index 1c51cef7b..47f2627cf 100644 --- a/lib/config/expression.hpp +++ b/lib/config/expression.hpp @@ -802,6 +802,18 @@ public: : DebuggableExpression(debugInfo), m_Args(args), m_Name(name), m_ClosedVars(closedVars), m_Expression(expression) { } + ~FunctionExpression(void) + { + if (m_ClosedVars) { + typedef std::pair kv_pair; + BOOST_FOREACH(const kv_pair& kv, *m_ClosedVars) { + delete kv.second; + } + } + + delete m_ClosedVars; + } + protected: virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override; @@ -828,6 +840,15 @@ public: ~ApplyExpression(void) { delete m_Name; + + if (m_ClosedVars) { + typedef std::pair kv_pair; + BOOST_FOREACH(const kv_pair& kv, *m_ClosedVars) { + delete kv.second; + } + } + + delete m_ClosedVars; } protected: @@ -861,6 +882,15 @@ public: ~ObjectExpression(void) { delete m_Name; + + if (m_ClosedVars) { + typedef std::pair kv_pair; + BOOST_FOREACH(const kv_pair& kv, *m_ClosedVars) { + delete kv.second; + } + } + + delete m_ClosedVars; } protected: