Commit 12d7abab authored by george's avatar george

removed leaks in calcDerivatives

git-svn-id: https://www.dynare.org/svn/dynare/trunk@3203 ac1d8469-bf42-47a9-8791-bf33cf982152
parent cf933608
......@@ -135,8 +135,8 @@ KordpDynare::evaluateSystem(Vector &out, const Vector &yym, const Vector &yy,
void
KordpDynare::calcDerivatives(const Vector &yy, const Vector &xx) throw (DynareException)
{
TwoDMatrix *g2 = NULL;
TwoDMatrix *g3 = NULL;
TwoDMatrix *g2 = 0;// NULL;
TwoDMatrix *g3 = 0;// NULL;
TwoDMatrix *g1 = new TwoDMatrix(nY, nJcols); // generate g1 for jacobian
g1->zeros();
......@@ -169,10 +169,17 @@ KordpDynare::calcDerivatives(const Vector &yy, const Vector &xx) throw (DynareEx
throw DynareException(__FILE__, __LINE__, "Error in calcDerivatives: dynamicDLL.eval returned wrong jacobian");
populateDerivativesContainer(g1, 1, JacobianIndices);
delete g1;
if (nOrder > 1)
populateDerivativesContainer(g2, 2, JacobianIndices);
{
populateDerivativesContainer(g2, 2, JacobianIndices);
delete g2;
}
if (nOrder > 2)
populateDerivativesContainer(g3, 3, JacobianIndices);
{
populateDerivativesContainer(g3, 3, JacobianIndices);
delete g3;
}
}
void
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment