Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2013-10-03 11:01:32 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-10-03 11:01:32 +0400
commitf3e41046fe171175f4cb754d5e1b3161ae1adc8a (patch)
tree82067e66bbdc7cfaa372e1ea5f80b51165210c02 /source/blender/editors/object/object_vgroup.c
parent962c183471eefdbe480ce5dcec13ee1bc6478182 (diff)
fix bug in ED_vgroup_subset_from_select_type, setting negative index in boolean array.
also was freeing NULL pointer in vgroup_blend_subset()
Diffstat (limited to 'source/blender/editors/object/object_vgroup.c')
-rw-r--r--source/blender/editors/object/object_vgroup.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c
index 917f816d6b1..82454baae78 100644
--- a/source/blender/editors/object/object_vgroup.c
+++ b/source/blender/editors/object/object_vgroup.c
@@ -1480,7 +1480,7 @@ bool *ED_vgroup_subset_from_select_type(Object *ob, eVGroupSelect subset_type, i
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 @@ static void vgroup_blend_subset(Object *ob, const bool *vgroup_validmap, const i
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 @@ static void vgroup_blend_subset(Object *ob, const bool *vgroup_validmap, const i
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);
}
}