diff options
Diffstat (limited to 'source/blender/editors/transform/transform_input.c')
-rw-r--r-- | source/blender/editors/transform/transform_input.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/source/blender/editors/transform/transform_input.c b/source/blender/editors/transform/transform_input.c index dd1510498b0..4e9a54692a5 100644 --- a/source/blender/editors/transform/transform_input.c +++ b/source/blender/editors/transform/transform_input.c @@ -307,15 +307,8 @@ static void calcSpringFactor(MouseInput *mi) void initMouseInputMode(TransInfo *t, MouseInput *mi, MouseInputMode mode) { - /* may have been allocated previously */ - /* TODO, holding R-key can cause mem leak, but this causes [#28903] - * disable for now. */ -#if 0 - if (mi->data) { - MEM_freeN(mi->data); - mi->data = NULL; - } -#endif + /* incase we allocate a new value */ + void *mi_data_prev = mi->data; switch (mode) { case INPUT_VECTOR: @@ -374,6 +367,12 @@ void initMouseInputMode(TransInfo *t, MouseInput *mi, MouseInputMode mode) break; } + /* if we've allocated new data, free the old data + * less hassle then checking before every alloc above */ + if (mi_data_prev && (mi_data_prev != mi->data)) { + MEM_freeN(mi_data_prev); + } + /* bootstrap mouse input with initial values */ applyMouseInput(t, mi, mi->imval, t->values); } |