Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2012-02-02 12:48:43 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2012-02-02 12:48:43 +0400
commit6a30321434089fb4a4e189d72d0c4c1355c534a3 (patch)
treefc056301f9954faf11666092d47506bbbcba6b7b /source/blender/blenkernel/intern/navmesh_conversion.c
parent722e0d38ac34923be344443651b8c7c39a9d86b8 (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/blender/blenkernel/intern/navmesh_conversion.c')
-rw-r--r--source/blender/blenkernel/intern/navmesh_conversion.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/navmesh_conversion.c b/source/blender/blenkernel/intern/navmesh_conversion.c
index e3b5b83964e..e6749730fc9 100644
--- a/source/blender/blenkernel/intern/navmesh_conversion.c
+++ b/source/blender/blenkernel/intern/navmesh_conversion.c
@@ -344,7 +344,7 @@ int buildNavMeshData(const int nverts, const float* verts,
int *vertsPerPoly_r, int **dtrisToPolysMap_r, int **dtrisToTrisMap_r)
{
- int *trisMapping = MEM_callocN(sizeof(int)*ntris, "buildNavMeshData trisMapping");
+ int *trisMapping;
int i;
struct SortContext context;
int validTriStart, prevPolyIdx, curPolyIdx, newPolyIdx, prevpolyidx;
@@ -360,6 +360,8 @@ int buildNavMeshData(const int nverts, const float* verts,
return 0;
}
+ trisMapping = MEM_callocN(sizeof(int)*ntris, "buildNavMeshData trisMapping");
+
//sort the triangles by polygon idx
for (i=0; i<ntris; i++)
trisMapping[i]=i;