diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-01-17 07:43:00 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-01-17 07:43:34 +0300 |
commit | 4a3aac478ce0dd16faea52d224d9a8024cd9ee57 (patch) | |
tree | 5df4a6b98175bfb31c0aeb5d6e24e8c4c4139fa2 /source/blender/editors/interface/interface_eyedropper_colorband.c | |
parent | 3648b3f9165a096cf4204bb9ad082e62cc714c90 (diff) |
Cleanup: logic for eyedropper free on failure
Although currently unused, if exec was called and failed it would leak.
Diffstat (limited to 'source/blender/editors/interface/interface_eyedropper_colorband.c')
-rw-r--r-- | source/blender/editors/interface/interface_eyedropper_colorband.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/source/blender/editors/interface/interface_eyedropper_colorband.c b/source/blender/editors/interface/interface_eyedropper_colorband.c index a807a16671c..262aed77b37 100644 --- a/source/blender/editors/interface/interface_eyedropper_colorband.c +++ b/source/blender/editors/interface/interface_eyedropper_colorband.c @@ -83,7 +83,6 @@ struct EyedropperColorband_Context { static bool eyedropper_colorband_init(bContext *C, wmOperator *op) { ColorBand *band = NULL; - EyedropperColorband *eye; uiBut *but = UI_context_active_but_get(C); @@ -99,10 +98,11 @@ static bool eyedropper_colorband_init(bContext *C, wmOperator *op) band = (ColorBand *)but->custom_data; } - if (!band) + if (!band) { return false; + } - op->customdata = eye = MEM_callocN(sizeof(EyedropperColorband), __func__); + EyedropperColorband *eye = MEM_callocN(sizeof(EyedropperColorband), __func__); eye->color_buffer_alloc = 16; eye->color_buffer = MEM_mallocN(sizeof(*eye->color_buffer) * eye->color_buffer_alloc, __func__); eye->color_buffer_len = 0; @@ -111,6 +111,8 @@ static bool eyedropper_colorband_init(bContext *C, wmOperator *op) eye->ptr = ((Colorband_RNAUpdateCb *)but->func_argN)->ptr; eye->prop = ((Colorband_RNAUpdateCb *)but->func_argN)->prop; + op->customdata = eye; + return true; } @@ -266,7 +268,6 @@ static int eyedropper_colorband_invoke(bContext *C, wmOperator *op, const wmEven return OPERATOR_RUNNING_MODAL; } else { - eyedropper_colorband_exit(C, op); return OPERATOR_CANCELLED; } } |