diff --git a/matrix.c b/matrix.c index 0f5944d..5e189ea 100644 --- a/matrix.c +++ b/matrix.c @@ -41,7 +41,12 @@ Matrix createMatrix(unsigned int rows, unsigned int cols) void clearMatrix(Matrix *matrix) { - + if (matrix->buffer != NULL){ + free (matrix->buffer); + matrix->buffer = NULL; + } + matrix->rows = 0; + matrix->cols = 0; } void setMatrixAt(MatrixType value, Matrix matrix, unsigned int rowIdx, unsigned int colIdx)