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
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-10-06 05:51:01 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-10-06 05:51:01 +0400
commit4e6be49ca46f20879c9e1e75ec9cb9340eabf62f (patch)
tree4566ee74c24b38f69d79358553fffe3bd85d8698 /source
parent4b1ba6bef63ce4d4a17f834f8bbd0f60d1a0a008 (diff)
fix for memory leak when calling wpaint_make_validmap() with no vertex groups.
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c
index 3ba81715b90..c3b575d5d21 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -1812,17 +1812,20 @@ static char *wpaint_make_validmap(Object *ob)
bDeformGroup *dg;
ModifierData *md;
char *vgroup_validmap;
- GHash *gh = BLI_ghash_new(BLI_ghashutil_strhash, BLI_ghashutil_strcmp, "wpaint_make_validmap gh");
+ GHash *gh;
int i = 0, step1=1;
+ if(ob->defbase.first == NULL) {
+ return NULL;
+ }
+
+ gh= BLI_ghash_new(BLI_ghashutil_strhash, BLI_ghashutil_strcmp, "wpaint_make_validmap gh");
+
/*add all names to a hash table*/
- for (dg=ob->defbase.first, i=0; dg; dg=dg->next, i++) {
+ for (dg=ob->defbase.first; dg; dg=dg->next) {
BLI_ghash_insert(gh, dg->name, NULL);
}
- if (!i)
- return NULL;
-
vgroup_validmap= MEM_callocN(i, "wpaint valid map");
/*now loop through the armature modifiers and identify deform bones*/