diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-08-04 07:02:35 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-08-04 07:02:35 +0400 |
commit | 704598ef4eebaca794da8884dbec42d5f259736f (patch) | |
tree | 63bfb1843568d917f1466c343caa036975d0f555 /source/gameengine/Ketsji | |
parent | bd89bd9e1c49369d9d08bf262602a7520cec7123 (diff) |
avoid freeing NULL pointer for navmesh BuildVertIndArrays and dont truncate memset arg.
Diffstat (limited to 'source/gameengine/Ketsji')
-rw-r--r-- | source/gameengine/Ketsji/KX_NavMeshObject.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/source/gameengine/Ketsji/KX_NavMeshObject.cpp b/source/gameengine/Ketsji/KX_NavMeshObject.cpp index 24400398f03..bf9c6ddb442 100644 --- a/source/gameengine/Ketsji/KX_NavMeshObject.cpp +++ b/source/gameengine/Ketsji/KX_NavMeshObject.cpp @@ -120,14 +120,14 @@ bool KX_NavMeshObject::BuildVertIndArrays(float *&vertices, int& nverts, int nAllVerts = 0; float *allVerts = NULL; buildNavMeshDataByDerivedMesh(dm, &vertsPerPoly, &nAllVerts, &allVerts, &ndtris, &dtris, - &npolys, &dmeshes, &polys, &dtrisToPolysMap, &dtrisToTrisMap, &trisToFacesMap); + &npolys, &dmeshes, &polys, &dtrisToPolysMap, &dtrisToTrisMap, &trisToFacesMap); - MEM_freeN(dtrisToPolysMap); - MEM_freeN(dtrisToTrisMap); - MEM_freeN(trisToFacesMap); + MEM_SAFE_FREE(dtrisToPolysMap); + MEM_SAFE_FREE(dtrisToTrisMap); + MEM_SAFE_FREE(trisToFacesMap); unsigned short *verticesMap = new unsigned short[nAllVerts]; - memset(verticesMap, 0xffff, sizeof(unsigned short)*nAllVerts); + memset(verticesMap, 0xff, sizeof(*verticesMap) * nAllVerts); int curIdx = 0; //vertices - mesh verts //iterate over all polys and create map for their vertices first... |