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:
authorCampbell Barton <ideasman42@gmail.com>2012-07-03 12:16:14 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-07-03 12:16:14 +0400
commit55027b8232b8bd3656ddde642b26dd8fcc0d1064 (patch)
treeda0932f9f123d0136191c787da30f3ca0eadf51b
parentff9a4e445e62a63b6baaa48cefd7357d62fd87c1 (diff)
fix for memory leak in BKE_mesh_ensure_navmesh(), it would add 2 navmesh layers, once referencing the other.
-rw-r--r--source/blender/blenkernel/intern/mesh.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c
index e3b13ca0f17..6d47575b372 100644
--- a/source/blender/blenkernel/intern/mesh.c
+++ b/source/blender/blenkernel/intern/mesh.c
@@ -3146,19 +3146,17 @@ void BKE_mesh_translate(Mesh *me, float offset[3], int do_keys)
}
}
-
void BKE_mesh_ensure_navmesh(Mesh *me)
{
if (!CustomData_has_layer(&me->pdata, CD_RECAST)) {
int i;
int numFaces = me->totpoly;
int *recastData;
- CustomData_add_layer_named(&me->pdata, CD_RECAST, CD_CALLOC, NULL, numFaces, "recastData");
- recastData = (int *)CustomData_get_layer(&me->pdata, CD_RECAST);
+ recastData = (int *)MEM_mallocN(numFaces * sizeof(int), __func__);
for (i = 0; i < numFaces; i++) {
recastData[i] = i + 1;
}
- CustomData_add_layer_named(&me->pdata, CD_RECAST, CD_REFERENCE, recastData, numFaces, "recastData");
+ CustomData_add_layer_named(&me->pdata, CD_RECAST, CD_ASSIGN, recastData, numFaces, "recastData");
}
}