Fix memory leak for the 'use' keyword

fixes #12487
This commit is contained in:
Gunnar Beutner 2016-08-19 09:07:57 +02:00
parent b7ef02f8c8
commit b5637a2d16
1 changed files with 30 additions and 0 deletions

View File

@ -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<String, Expression *> 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<String, Expression *> 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<String, Expression *> kv_pair;
BOOST_FOREACH(const kv_pair& kv, *m_ClosedVars) {
delete kv.second;
}
}
delete m_ClosedVars;
}
protected: