diff --git a/matrix.c b/matrix.c index de25a4a..5dd668c 100644 --- a/matrix.c +++ b/matrix.c @@ -17,11 +17,13 @@ Matrix createMatrix(unsigned int rows, unsigned int cols) newMatrix.rows = rows; newMatrix.cols = cols; newMatrix.buffer = calloc(rows*cols, sizeof(MatrixType)) + return newMatrix; } void clearMatrix(Matrix *matrix) { - + free(*matrix.buffer); + *matrix.buffer = NULL; } void setMatrixAt(MatrixType value, Matrix matrix, unsigned int rowIdx, unsigned int colIdx)