[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [60521] trunk/blender/source/blender/ editors/object/object_vgroup.c: fix bug in ED_vgroup_subset_from_select_type, setting negative index in boolean array.

Campbell Barton ideasman42 at gmail.com
Thu Oct 3 09:01:32 CEST 2013


Revision: 60521
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=60521
Author:   campbellbarton
Date:     2013-10-03 07:01:32 +0000 (Thu, 03 Oct 2013)
Log Message:
-----------
fix bug in ED_vgroup_subset_from_select_type, setting negative index in boolean array.
also was freeing NULL pointer in vgroup_blend_subset()

Modified Paths:
--------------
    trunk/blender/source/blender/editors/object/object_vgroup.c

Modified: trunk/blender/source/blender/editors/object/object_vgroup.c
===================================================================
--- trunk/blender/source/blender/editors/object/object_vgroup.c	2013-10-03 06:12:44 UTC (rev 60520)
+++ trunk/blender/source/blender/editors/object/object_vgroup.c	2013-10-03 07:01:32 UTC (rev 60521)
@@ -1480,7 +1480,7 @@
 			const int def_nr_active = ob->actdef - 1;
 			vgroup_validmap = MEM_mallocN(*r_vgroup_tot * sizeof(*vgroup_validmap), __func__);
 			memset(vgroup_validmap, false, *r_vgroup_tot * sizeof(*vgroup_validmap));
-			if (def_nr_active < *r_vgroup_tot) {
+			if ((def_nr_active >= 0) && (def_nr_active < *r_vgroup_tot)) {
 				*r_subset_count = 1;
 				vgroup_validmap[def_nr_active] = true;
 			}
@@ -2262,7 +2262,8 @@
 		MEM_freeN(emap_mem);
 	}
 
-	MEM_freeN(dvert_array);
+	if (dvert_array)
+		MEM_freeN(dvert_array);
 	BLI_SMALLSTACK_FREE(dv_stack);
 
 	/* not so efficient to get 'dvert_array' again just so unselected verts are NULL'd */
@@ -2270,7 +2271,8 @@
 		ED_vgroup_parray_alloc(ob->data, &dvert_array, &dvert_tot, true);
 		ED_vgroup_parray_mirror_sync(ob, dvert_array, dvert_tot,
 		                             vgroup_validmap, vgroup_tot);
-		MEM_freeN(dvert_array);
+		if (dvert_array)
+			MEM_freeN(dvert_array);
 	}
 }
 




More information about the Bf-blender-cvs mailing list