Fix a memory leak in *Expression::GetReference

fixes #8593
This commit is contained in:
Gunnar Beutner 2015-03-04 08:00:38 +01:00
parent c9c7f9bed1
commit 9bbe9a4875
1 changed files with 6 additions and 3 deletions

View File

@ -597,8 +597,9 @@ bool IndexerExpression::GetReference(ScriptFrame& frame, bool init_dict, Value *
{ {
Value vparent; Value vparent;
String vindex; String vindex;
DebugHint *psdhint = NULL;
if (m_Operand1->GetReference(frame, init_dict, &vparent, &vindex, dhint)) { if (m_Operand1->GetReference(frame, init_dict, &vparent, &vindex, &psdhint)) {
if (init_dict && VMOps::GetField(vparent, vindex, m_Operand1->GetDebugInfo()).IsEmpty()) if (init_dict && VMOps::GetField(vparent, vindex, m_Operand1->GetDebugInfo()).IsEmpty())
VMOps::SetField(vparent, vindex, new Dictionary(), m_Operand1->GetDebugInfo()); VMOps::SetField(vparent, vindex, new Dictionary(), m_Operand1->GetDebugInfo());
@ -611,8 +612,10 @@ bool IndexerExpression::GetReference(ScriptFrame& frame, bool init_dict, Value *
ExpressionResult operand2 = m_Operand2->Evaluate(frame); ExpressionResult operand2 = m_Operand2->Evaluate(frame);
*index = operand2.GetValue(); *index = operand2.GetValue();
if (dhint && *dhint) if (dhint && psdhint)
*dhint = new DebugHint((*dhint)->GetChild(*index)); *dhint = new DebugHint(psdhint->GetChild(*index));
delete psdhint;
return true; return true;
} }