1
0
forked from mirrors/0ad

Fix memory leak in CCmpPathfinder, patch by Sandarac.

The terrain grid can be renewed without proper deallocation, which
happens at least at the start of a game when MT_TerrainChanged is sent.

Reviewers: wraitii, Itms

Differential Revision: https://code.wildfiregames.com/D247
This was SVN commit r19388.
This commit is contained in:
Itms
2017-04-08 15:58:10 +00:00
parent 2aae9eaaf1
commit 32c0dc773e
@@ -470,6 +470,7 @@ void CCmpPathfinder::UpdateGrid()
{
m_MapSize = terrainSize;
m_Grid = new Grid<NavcellData>(m_MapSize * Pathfinding::NAVCELLS_PER_TILE, m_MapSize * Pathfinding::NAVCELLS_PER_TILE);
SAFE_DELETE(m_TerrainOnlyGrid);
m_TerrainOnlyGrid = new Grid<NavcellData>(m_MapSize * Pathfinding::NAVCELLS_PER_TILE, m_MapSize * Pathfinding::NAVCELLS_PER_TILE);
m_ObstructionsDirty = { true, true, true, Grid<u8>(m_MapSize * Pathfinding::NAVCELLS_PER_TILE, m_MapSize * Pathfinding::NAVCELLS_PER_TILE) };