I'm trying to write a method to overload the * operator for multiplying matrices. the matrix it self has its data stored in a dynamically allocated array "_mat_arr" and after running a valgrind check i cant seem to free it properly after finishing with this method.
Matrix Matrix::operator* (const Matrix& rhs)
{
    Matrix new_mat(this->_rows,rhs._cols);
   /*...code to fill the product matrix...*/
    return new_mat;
}
this is my destructor
~Matrix() /*destructor*/
    {
        delete [] _mat_arr;
        _mat_arr = nullptr;
    }
this is my class constructor where i allocate the matrix array
Matrix(int rows, int cols):_rows(rows),_cols(cols)
    {
        _mat_arr = new int [cols*rows];
        for(int i = 0; i < rows * cols; i++)
        {
            _mat_arr[i] = 0;
        }
        _rowLen = _cols -1;
    }
edit: changed delete to delete[]. after running the debugger i think that the problem is that the destructor is not called on new_mat which is allocated inside the method.
 
    