From 3dc5f92f97f67473122136e44bdee06e48cb32ad Mon Sep 17 00:00:00 2001 From: Vincent Loechner Date: Thu, 4 Feb 2016 14:30:13 +0100 Subject: [PATCH] fixed memory leak --- source/kernel/SolveDio.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/source/kernel/SolveDio.c b/source/kernel/SolveDio.c index e1553bb..114ae49 100644 --- a/source/kernel/SolveDio.c +++ b/source/kernel/SolveDio.c @@ -146,6 +146,9 @@ int SolveDiophantine(Matrix *M, Matrix **U, Vector **X) { if (value_notzero_p(tmp)) { /* no solution to the equation */ *U = Matrix_Alloc(0,0); *X = Vector_Alloc (0); + Matrix_Free (unimod); + Matrix_Free (hermi); + Matrix_Free (temp); value_clear(sum); value_clear(tmp); for (i = 0; i < k1; i++) value_clear(C[i]); @@ -176,6 +179,9 @@ int SolveDiophantine(Matrix *M, Matrix **U, Vector **X) { if (value_ne(sum,C[i])) { *U = Matrix_Alloc(0,0); *X = Vector_Alloc (0); + Matrix_Free (unimod); + Matrix_Free (hermi); + Matrix_Free (temp); value_clear(sum); value_clear(tmp); for (i = 0; i < k1; i++) value_clear(C[i]); @@ -185,7 +191,7 @@ int SolveDiophantine(Matrix *M, Matrix **U, Vector **X) { free(T); return (-1); } - } + } unimodinv = Matrix_Alloc(unimod->NbRows, unimod->NbColumns); Matrix_Inverse(unimod, unimodinv); Matrix_Free(unimod); -- 2.11.4.GIT