[Bf-blender-cvs] [702f374] master: Fix for possible (unlikely) uninitialized var use in BM_face_split

Campbell Barton noreply at git.blender.org
Thu Mar 13 08:44:35 CET 2014


Commit: 702f374972ed97392ab2d03ec46434092ad9fca8
Author: Campbell Barton
Date:   Thu Mar 13 18:35:41 2014 +1100
https://developer.blender.org/rB702f374972ed97392ab2d03ec46434092ad9fca8

Fix for possible (unlikely) uninitialized var use in BM_face_split

===================================================================

M	source/blender/bmesh/intern/bmesh_mods.c

===================================================================

diff --git a/source/blender/bmesh/intern/bmesh_mods.c b/source/blender/bmesh/intern/bmesh_mods.c
index a7e3c12..9696eb6 100644
--- a/source/blender/bmesh/intern/bmesh_mods.c
+++ b/source/blender/bmesh/intern/bmesh_mods.c
@@ -281,11 +281,12 @@ BMFace *BM_face_split(BMesh *bm, BMFace *f,
 	BLI_assert(!BM_loop_is_adjacent(l_a, l_b));
 
 	/* could be an assert */
-	if (UNLIKELY(BM_loop_is_adjacent(l_a, l_b))) {
-		return NULL;
-	}
-
-	if (f != l_a->f || f != l_b->f) {
+	if (UNLIKELY(BM_loop_is_adjacent(l_a, l_b)) ||
+	    UNLIKELY((f != l_a->f || f != l_b->f)))
+	{
+		if (r_l) {
+			*r_l = NULL;
+		}
 		return NULL;
 	}
 
@@ -368,11 +369,12 @@ BMFace *BM_face_split_n(BMesh *bm, BMFace *f,
 	BLI_assert(!((n == 0) && BM_loop_is_adjacent(l_a, l_b)));
 
 	/* could be an assert */
-	if (UNLIKELY((n == 0) && BM_loop_is_adjacent(l_a, l_b))) {
-		return NULL;
-	}
-
-	if (l_a->f != l_b->f) {
+	if (UNLIKELY((n == 0) && BM_loop_is_adjacent(l_a, l_b)) ||
+	    UNLIKELY(l_a->f != l_b->f))
+	{
+		if (r_l) {
+			*r_l = NULL;
+		}
 		return NULL;
 	}
 
@@ -495,12 +497,13 @@ BMEdge *BM_vert_collapse_faces(BMesh *bm, BMEdge *e_kill, BMVert *v_kill, float
 		if (BLI_array_count(faces) >= 2) {
 			BMFace *f2 = BM_faces_join(bm, faces, BLI_array_count(faces), true);
 			if (f2) {
-				BMLoop *l_new = NULL;
 				BMLoop *l_a, *l_b;
 
 				if ((l_a = BM_face_vert_share_loop(f2, tv)) &&
 				    (l_b = BM_face_vert_share_loop(f2, tv2)))
 				{
+					BMLoop *l_new;
+
 					if (BM_face_split(bm, f2, l_a, l_b, &l_new, NULL, false)) {
 						e_new = l_new->e;
 					}




More information about the Bf-blender-cvs mailing list