mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-26 05:38:22 +01:00
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
This commit is contained in:
parent
a0f72a4fe0
commit
6f9daa4a3a
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user