[poincare] Correct memory leaking issue

Change-Id: Ide22a702f7a23b140cad7cd61f4543355b2de8f6
This commit is contained in:
Émilie Feral
2016-12-08 11:59:07 +01:00
parent 357f971120
commit 4df7f4aaa1

View File

@@ -40,13 +40,11 @@ Expression * Power::evaluateOnMatrixAndInteger(Matrix * m, Integer * i, Context&
Expression * operands[2];
operands[0] = result;
operands[1] = m;
Expression * next = new Product(operands, true);
/* We do not need to suppress next, as we suppress result and m is handle by
* another scope (TODO: something feels wrong. Check again) */
Expression * newResult = next->evaluate(context);
Expression * product = new Product(operands, true);
Expression * newResult = product->evaluate(context);
delete result;
result = newResult;
delete next;
delete product;
}
return result;
}