From d2ff21e75de906d90f3d338871ca35756e94bfea Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 11 Feb 2020 22:11:51 +1100 Subject: Fix memory leak with 2D image painting Regression from c30d6571bb477 --- source/blender/editors/sculpt_paint/paint_image_2d.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/blender/editors/sculpt_paint/paint_image_2d.c b/source/blender/editors/sculpt_paint/paint_image_2d.c index 7f71110b360..a667c7062e6 100644 --- a/source/blender/editors/sculpt_paint/paint_image_2d.c +++ b/source/blender/editors/sculpt_paint/paint_image_2d.c @@ -1646,7 +1646,7 @@ void paint_2d_stroke(void *ps, continue; } - ImBuf *ibuf = BKE_image_acquire_ibuf(s->image, &tile->iuser, NULL); + ImBuf *ibuf = tile->canvas; /* OCIO_TODO: float buffers are now always linear, so always use color correction * this should probably be changed when texture painting color space is supported @@ -1711,6 +1711,7 @@ void *paint_2d_new_stroke(bContext *C, wmOperator *op, int mode) } if (ibuf->channels != 4) { + BKE_image_release_ibuf(s->image, ibuf, NULL); BKE_report(op->reports, RPT_WARNING, "Image requires 4 color channels to paint"); MEM_freeN(s->tiles); MEM_freeN(s); -- cgit v1.2.3