From 6f9daa4a3adcb0a0370391e9be0d3b96943f72c0 Mon Sep 17 00:00:00 2001 From: James Zern Date: Tue, 1 Aug 2017 03:23:52 +0000 Subject: [PATCH] jpegdec,ReadError: fix leaks on error everything post jpeg decoder creation should go through the error path to ensure it's cleaned up properly Change-Id: If78b4529e40797c67c3d0e624af1c036badea674 --- imageio/jpegdec.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/imageio/jpegdec.c b/imageio/jpegdec.c index 70341bc3..eefe92f9 100644 --- a/imageio/jpegdec.c +++ b/imageio/jpegdec.c @@ -304,18 +304,18 @@ int ReadJPEG(const uint8_t* const data, size_t data_size, if (stride != (int)stride || !ImgIoUtilCheckSizeArgumentsOverflow(stride, height)) { - goto End; + goto Error; } rgb = (uint8_t*)malloc((size_t)stride * height); if (rgb == NULL) { - goto End; + goto Error; } buffer[0] = (JSAMPLE*)rgb; while (dinfo.output_scanline < dinfo.output_height) { if (jpeg_read_scanlines((j_decompress_ptr)&dinfo, buffer, 1) != 1) { - goto End; + goto Error; } buffer[0] += stride; }