diff options
author | Campbell Barton <ideasman42@gmail.com> | 2016-03-31 21:42:15 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-04-05 11:36:12 +0300 |
commit | b3f08cddf3ec69275d4ac9d843a1d96d8713f93d (patch) | |
tree | 9e9070f56e603d5dc955ce017470924545a611df /source/blender | |
parent | 3108861981dbeedc679b2b9015f18d46f6d718e3 (diff) |
Fix NULL check before free
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/mesh/editmesh_knife.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c index 59967ffb2bb..94807559a75 100644 --- a/source/blender/editors/mesh/editmesh_knife.c +++ b/source/blender/editors/mesh/editmesh_knife.c @@ -2276,12 +2276,8 @@ static void knife_make_face_cuts(KnifeTool_OpData *kcd, BMFace *f, ListBase *kfe KnifeEdge *kfe; Ref *ref; int edge_array_len = BLI_listbase_count(kfedges); - bool ok; int i; - BMFace **face_arr; - int face_arr_len; - BMEdge **edge_array = BLI_array_alloca(edge_array, edge_array_len); /* point to knife edges we've created edges in, edge_array aligned */ @@ -2357,12 +2353,17 @@ static void knife_make_face_cuts(KnifeTool_OpData *kcd, BMFace *f, ListBase *kfe } #endif - ok = BM_face_split_edgenet( - bm, f, edge_array, edge_array_len, - &face_arr, &face_arr_len); + { + BMFace **face_arr = NULL; + int face_arr_len; + + BM_face_split_edgenet( + bm, f, edge_array, edge_array_len, + &face_arr, &face_arr_len); - if (ok) { - MEM_freeN(face_arr); + if (face_arr) { + MEM_freeN(face_arr); + } } /* remove dangling edges, not essential - but nice for users */ |