diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-02-02 12:48:43 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-02-02 12:48:43 +0400 |
commit | 6a30321434089fb4a4e189d72d0c4c1355c534a3 (patch) | |
tree | fc056301f9954faf11666092d47506bbbcba6b7b /source/gameengine | |
parent | 722e0d38ac34923be344443651b8c7c39a9d86b8 (diff) |
Fix #29381: Navmeshs frees not guarded allocated memory and leaked
There were two issues discovered:
- Triangles mapping didn't free in buildNavMeshData if there's no recast data for an object
- KX_NavMeshObject used not-guarded allocation for polygons storage, but used guarded
freeing stuff to free used memory, producing error messages in the console and leading to
memory leak.
Wasn't actually harmful for users -- there was no memory corruptions and error happens only
when object was set up in a way when navmesh can't work in theory.
Diffstat (limited to 'source/gameengine')
-rw-r--r-- | source/gameengine/Ketsji/KX_NavMeshObject.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/source/gameengine/Ketsji/KX_NavMeshObject.cpp b/source/gameengine/Ketsji/KX_NavMeshObject.cpp index 6765f07b344..f92319e508b 100644 --- a/source/gameengine/Ketsji/KX_NavMeshObject.cpp +++ b/source/gameengine/Ketsji/KX_NavMeshObject.cpp @@ -248,7 +248,7 @@ bool KX_NavMeshObject::BuildVertIndArrays(float *&vertices, int& nverts, } //create tris - polys = new unsigned short[npolys*3*2]; + polys = (unsigned short*)MEM_callocN(sizeof(unsigned short)*3*2*npolys, "BuildVertIndArrays polys"); memset(polys, 0xff, sizeof(unsigned short)*3*2*npolys); unsigned short *poly = polys; RAS_Polygon* raspoly; |