diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-08-04 02:36:59 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-08-04 02:36:59 +0400 |
commit | 0c659da03bafb28c3c4b3752f6df2f6a446d025d (patch) | |
tree | 1ae95cab6a914c59377b500f3638ca8037e2347c | |
parent | 81b8bdc353e8ae129b40a55d619ad59c4ee118e6 (diff) |
bugfix [#23158] Translate operator leaks memory if nothing selected
-rw-r--r-- | source/blender/editors/transform/transform.c | 1 | ||||
-rw-r--r-- | source/blender/editors/transform/transform_ops.c | 9 |
2 files changed, 8 insertions, 2 deletions
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 926d8ffd007..2550da13ad7 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -1460,6 +1460,7 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op) } } +/* note: caller needs to free 't' on a 0 return */ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int mode) { int options = 0; diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c index 29bcd4e8592..da454d1f03d 100644 --- a/source/blender/editors/transform/transform_ops.c +++ b/source/blender/editors/transform/transform_ops.c @@ -281,7 +281,7 @@ static int transformops_data(bContext *C, wmOperator *op, wmEvent *event) int retval = 1; if (op->customdata == NULL) { - TransInfo *t = MEM_callocN(sizeof(TransInfo), "TransInfo data"); + TransInfo *t = MEM_callocN(sizeof(TransInfo), "TransInfo data2"); TransformModeItem *tmode; int mode = -1; @@ -303,7 +303,12 @@ static int transformops_data(bContext *C, wmOperator *op, wmEvent *event) G.moving = 1; /* store data */ - op->customdata = t; + if(retval) { + op->customdata = t; + } + else { + MEM_freeN(t); + } } return retval; /* return 0 on error */ |