diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2012-05-01 16:38:26 +0400 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2012-05-01 16:38:26 +0400 |
commit | 7dce43da21df186d66f00d7b20547b5447eb6fe7 (patch) | |
tree | e48b609851fa72bbe6f578be7a4db33b3beba073 /source/blender/editors/mesh | |
parent | 8bd5648ce5fcae13b7dccfd50ae51ff49dffc637 (diff) |
Fix a potential memory leak in recent vertex xsort/randomize code.
Diffstat (limited to 'source/blender/editors/mesh')
-rw-r--r-- | source/blender/editors/mesh/editmesh_tools.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index 8fe0a364ad3..79e18f18f51 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -3683,8 +3683,11 @@ static void xsortvert_flag(bContext *C, int flag) } } /* printf("%d verts: %d to be sorted, %d unchanged…\n", totvert, sorted, unchanged);*/ - if (sorted == 0) + if (sorted == 0) { + MEM_freeN(sortblock); + MEM_freeN(unchangedblock); return; + } ED_view3d_init_mats_rv3d(vc.obedit, vc.rv3d); mesh_foreachScreenVert(&vc, xsortvert_flag__doSetX, sortblock, V3D_CLIP_TEST_OFF); @@ -3942,8 +3945,11 @@ static void hashvert_flag(BMEditMesh *em, int flag, unsigned int seed) } /* protected = totvert - randomized;*/ /* printf("%d verts: %d to be randomized, %d protected…\n", totvert, randomized, protected);*/ - if (randomized == 0) + if (randomized == 0) { + MEM_freeN(block); + MEM_freeN(randblock); return; + } /* Randomize non-protected vertices indices, and create an array mapping old idx to new |