BGE cleanup: Removing some potential memory leaks from KX_NavMeshObject when it fails to build a navmesh.

This commit is contained in:
Mitchell Stokes 2014-05-27 14:19:45 -07:00
parent 8dafbed4b5
commit 3b3908020e
1 changed files with 4 additions and 0 deletions

View File

@ -304,6 +304,7 @@ bool KX_NavMeshObject::BuildNavMesh()
|| vertsPerPoly<3)
{
printf("Can't build navigation mesh data for object:%s\n", m_name.ReadPtr());
if (vertices) delete[] vertices;
return false;
}
@ -325,7 +326,10 @@ bool KX_NavMeshObject::BuildNavMesh()
float cs = 0.2f;
if (!nverts || !npolys)
{
if (vertices) delete[] vertices;
return false;
}
float bmin[3], bmax[3];
calcMeshBounds(vertices, nverts, bmin, bmax);