diff --git a/matrix.c b/matrix.c index df12e0b..d24b836 100644 --- a/matrix.c +++ b/matrix.c @@ -23,8 +23,8 @@ Matrix createMatrix(unsigned int rows, unsigned int cols) void clearMatrix(Matrix *matrix) { - free(matrix.buffer); - matrix.buffer = NULL; + free(matrix->buffer); + matrix->buffer = NULL; } void setMatrixAt(MatrixType value, Matrix matrix, unsigned int rowIdx, unsigned int colIdx) @@ -55,8 +55,7 @@ Matrix add(const Matrix matrix1, const Matrix matrix2) Matrix MatrixErgebnis = createMatrix(matrix1.rows, matrix1.cols); //Creating Result Matrix if(matrix1.cols != matrix2.cols || matrix1.rows != matrix2.rows){ printf("Matrix dimensions do not match\n"); //Error Message if dimensions of Input Matrixes are not identical - clearMatrix(MatrixErgebnis); - MatrixErgebnis = NULL; + clearMatrix(&MatrixErgebnis); return MatrixErgebnis; } else{