1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-07-11 23:07:44 +00:00

Fix navmesh memory leak.

This commit is contained in:
collett 2020-01-01 22:08:17 +09:00
parent 9723977c47
commit cab6612285

View file

@ -316,8 +316,14 @@ unsigned char* TiledNavmeshGenerator::buildTileMesh( const int tx, const int ty,
int cid[512];// TODO: Make grow when returning too many items.
const int ncid = rcGetChunksOverlappingRect( m_chunkyMesh, tbmin, tbmax, cid, 512 );
if( !ncid )
if ( !ncid )
{
rcFreeHeightField(m_solid);
m_solid = nullptr;
delete[] m_triareas;
m_triareas = nullptr;
return nullptr;
}
m_tileTriCount = 0;
@ -452,6 +458,10 @@ unsigned char* TiledNavmeshGenerator::buildTileMesh( const int tx, const int ty,
if( m_cset->nconts == 0 )
{
rcFreeCompactHeightfield(m_chf);
rcFreeContourSet(m_cset);
m_chf = nullptr;
m_cset = nullptr;
return nullptr;
}