[poincare] Fix memory leak

Change-Id: I10f860eeb2fa4a7a1c6e358b208cc33f7d5d9d75
This commit is contained in:
Émilie Feral
2017-03-09 14:16:26 +01:00
parent 112bf400f6
commit 6da1fb2ae8
20 changed files with 80 additions and 38 deletions

View File

@@ -78,7 +78,8 @@ ExpressionLayout * Function::privateCreateLayout(FloatDisplayMode floatDisplayMo
grandChildrenLayouts[layoutIndex++] = m_args[i]->createLayout(floatDisplayMode, complexFormat);
}
ExpressionLayout * argumentLayouts = new HorizontalLayout(grandChildrenLayouts, 2*m_numberOfArguments-1);
ExpressionLayout ** childrenLayouts = (ExpressionLayout **)malloc(2*sizeof(ExpressionLayout *));
free(grandChildrenLayouts);
ExpressionLayout * childrenLayouts[2];
childrenLayouts[0] = new StringLayout(m_name, strlen(m_name));
childrenLayouts[1] = new ParenthesisLayout(argumentLayouts);
return new HorizontalLayout(childrenLayouts, 2);