I'm trying to delete pointer to a pointer of integer which is dynamically allocated, but I got unexpected error when I close the program.

First, declaration in header file

```
class TileMapManager
{
public: 
     //Some public constructor, destructor and some functions...

private:
    // Other private data...
    int m_xSize;
    int m_ySize;
    int **m_mapSlots;

};

```

allocation below...

```
m_mapSlots = new int*[m_ySize];
    for (int i = 0; i < m_xSize; ++i)
        m_mapSlots[i] = new int[m_xSize];

```

and release function. I call it in the destructor.

```
void TileMapManager::ReleaseTilemap(void)
{
    ReleaseTileTexture();

    for (int y = 0; y < m_ySize; ++y)
        delete m_mapSlots[y]; // <- break!

    delete m_mapSlots;  
}

```

my program has been triggered break point in that line.

I think the way of deleting is alright, but I don't know why it causes problem.
Help me plz.