From d3999683ff5ac8b42de74cb453b459096f76f542 Mon Sep 17 00:00:00 2001 From: Aaron Carlisle Date: Thu, 24 Mar 2022 21:20:26 -0400 Subject: WebP: Fix use after free --- source/blender/imbuf/intern/webp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/imbuf') diff --git a/source/blender/imbuf/intern/webp.c b/source/blender/imbuf/intern/webp.c index 89e1686493d..19fe2373ea0 100644 --- a/source/blender/imbuf/intern/webp.c +++ b/source/blender/imbuf/intern/webp.c @@ -85,7 +85,6 @@ bool imb_savewebp(struct ImBuf *ibuf, const char *name, int UNUSED(flags)) } last_row = (unsigned char *)(rgb_rect + (ibuf->y - 1) * ibuf->x * 3); - MEM_freeN(rgb_rect); if (ibuf->foptions.quality == 100.0f) { encoded_data_size = WebPEncodeLosslessRGB( @@ -95,6 +94,7 @@ bool imb_savewebp(struct ImBuf *ibuf, const char *name, int UNUSED(flags)) encoded_data_size = WebPEncodeRGB( last_row, ibuf->x, ibuf->y, -3 * ibuf->x, ibuf->foptions.quality, &encoded_data); } + MEM_freeN(rgb_rect); } else if (bytesperpixel == 4) { last_row = (unsigned char *)(ibuf->rect + (ibuf->y - 1) * ibuf->x); -- cgit v1.2.3