From e57d258169b0a358b27eb33416d949bfffbe7aea Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 22 Apr 2012 00:27:38 +0000 Subject: [PATCH] - fix memory leak in mesh_strip_loose_polysloops(), occurred during 3ds import. - updating normals in py/api's mesh.transform() wasn't working and gave annoying print, disable this, script authors can call calc_normals explicitly if they need. --- source/blender/blenkernel/intern/mesh.c | 4 +++- source/blender/editors/mesh/mesh_data.c | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index b80b15e57f3..af24240bf4a 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -1058,7 +1058,7 @@ void mesh_strip_loose_polysloops(Mesh *me) MLoop *l; int a, b; /* New loops idx! */ - int *new_idx = MEM_mallocN(sizeof(int) * me->totloop, "strip_loose_polysloops old2new idx mapping for polys."); + int *new_idx = MEM_mallocN(sizeof(int) * me->totloop, __func__); for (a = b = 0, p = me->mpoly; a < me->totpoly; a++, p++) { int invalid = FALSE; @@ -1119,6 +1119,8 @@ void mesh_strip_loose_polysloops(Mesh *me) for (a = 0, p = me->mpoly; a < me->totpoly; a++, p++) { p->loopstart = new_idx[p->loopstart]; } + + MEM_freeN(new_idx); } void mesh_strip_loose_edges(Mesh *me) diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c index d1fb437e114..5aea6f8d1c3 100644 --- a/source/blender/editors/mesh/mesh_data.c +++ b/source/blender/editors/mesh/mesh_data.c @@ -896,7 +896,7 @@ void ED_mesh_transform(Mesh *me, float *mat) for (i = 0; i < me->totvert; i++, mvert++) mul_m4_v3((float (*)[4])mat, mvert->co); - mesh_calc_normals_mapping(me->mvert, me->totvert, me->mloop, me->mpoly, me->totloop, me->totpoly, NULL, NULL, 0, NULL, NULL); + /* don't update normals, caller can do this explicitly */ } static void mesh_add_edges(Mesh *mesh, int len)