I keep getting the error Heap Corruption Detected. I have read through several questions on here, but I can't quite find out what is causing this in my code. I am trying to create a 2d array that will hold a matrix that is read from a text file. 

```
// Create a 2d matrix to hold the matrix (i = rows, j = columns)
matrix = new int*[cols];

for(int i = 0; i <= cols; i++) {
    matrix[i] = new int[rows];
}

// Populate the matrix from the text file
for (int i = 0; i < rows; i++) {
    for (int j = 0; j < cols; j++) {
        inputFile >> matrix[i][j];
    }
}

```

My destructor is:

```
for(int i = 0; i <= cols; i++) {
    delete[] matrix[i];
}

delete[] matrix;

```

I've tried debugging, but that does do much help in this case. Any suggestions?