[poincare][apps] Memory leaks

Change-Id: I2338760fb52bcf57997f7d82fd1f5cee68e95266
This commit is contained in:
Émilie Feral
2017-08-24 17:30:21 +02:00
parent c6598fb24d
commit 35a9753609
3 changed files with 10 additions and 3 deletions

View File

@@ -86,6 +86,7 @@ Evaluation<double> * Calculation::output(Context * context) {
Expression * exp = Expression::parse(m_outputText);
if (exp != nullptr) {
m_output = exp->evaluate<double>(*context);
delete exp;
} else {
m_output = new Complex<double>(Complex<double>::Float(NAN));
}

View File

@@ -91,7 +91,9 @@ Evaluation<U> * ComplexMatrix<T>::templatedEvaluate(Context& context, Expression
for (int i = 0; i < m_numberOfColumns*m_numberOfRows; i++) {
values[i] = Complex<U>::Cartesian(m_values[i].a(), m_values[i].b());
}
return new ComplexMatrix<U>(values, m_numberOfRows, m_numberOfColumns);
Evaluation<U> * result = new ComplexMatrix<U>(values, m_numberOfRows, m_numberOfColumns);
delete [] values;
return result;
}

View File

@@ -62,10 +62,14 @@ Evaluation<T> * Opposite::computeOnMatrix(Evaluation<T> * m) {
template<typename T>
Evaluation<T> * Opposite::templatedEvaluate(Context& context, AngleUnit angleUnit) const {
Evaluation<T> * operandEvalutation = m_operand->evaluate<T>(context, angleUnit);
Evaluation<T> * result = nullptr;
if (operandEvalutation->numberOfRows() == 1 && operandEvalutation->numberOfColumns() == 1) {
return new Complex<T>(compute(*(operandEvalutation->complexOperand(0))));
result = new Complex<T>(compute(*(operandEvalutation->complexOperand(0))));
} else {
result = computeOnMatrix(operandEvalutation);
}
return computeOnMatrix(operandEvalutation);
delete operandEvalutation;
return result;
}
ExpressionLayout * Opposite::privateCreateLayout(FloatDisplayMode floatDisplayMode, ComplexFormat complexFormat) const {