From 98e08eab3532e290459fa38912b94d74bbf63b46 Mon Sep 17 00:00:00 2001 From: Naej Date: Tue, 27 Dec 2016 22:26:06 +0100 Subject: [PATCH] =?UTF-8?q?corrig=C3=A9=20free?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LibAutomaton/matrix.c | 22 +++++++++++++--------- main.c | 3 +++ 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/LibAutomaton/matrix.c b/LibAutomaton/matrix.c index ed0b051..f49f7c4 100644 --- a/LibAutomaton/matrix.c +++ b/LibAutomaton/matrix.c @@ -83,7 +83,7 @@ bool CreateMatrixElem(Matrix matrix, int ColPos, int RowPos){ } else if (Col->data->rowIndex > RowPos){ elem->nextRow = Col->data; Col->data = elem; - } else { + } else {NMWZxm5uQt tmp = Col->data; while (tmp->nextRow != NULL && tmp->nextRow->rowIndex < RowPos){ tmp=tmp->nextRow; @@ -295,18 +295,22 @@ bool RecursiveFreeCol(Matrix matrix, cellElement * elem){ Matrix freeMatrix(Matrix matrix){ - ListElement * current = NULL; + int i = 0; + int j = 0; + + printf("\n---FREE MATRIX---\n"); - matrix.colCount = 0; - matrix.rowCount = 0; + for (i=0;ihead; - while (current != NULL){ - RecursiveFreeCol(matrix,current->data); - current = current->next; } + } + + printf("---END OF MATRIX---\n\n"); FreeList(matrix.cols); FreeList(matrix.rows); return matrix; diff --git a/main.c b/main.c index 32c6445..5652bfb 100644 --- a/main.c +++ b/main.c @@ -34,6 +34,9 @@ int main(int argc, char **argv){ freeMatrix(m2); m2 = rowSequenceOnMatrix(matrix, AND); BasicPrintMatrix(m2); + + /*sumMatrix(matrix,m2);*/ + freeMatrix(m2); freeMatrix(matrix);