Fix potential memleak in MPNG_CHUNK_IDAT

This commit is contained in:
twinaphex 2015-02-17 05:17:24 +01:00
parent 833335464a
commit 651da5f51c
1 changed files with 18 additions and 19 deletions

View File

@ -234,7 +234,6 @@ bool png_decode(const void *userdata, size_t len,
goto error;
break;
case MPNG_CHUNK_PLTE:
{
if (chunk.size % 3)
goto error;
@ -242,10 +241,8 @@ bool png_decode(const void *userdata, size_t len,
if (!mpng_read_plte(&ihdr, &chunk, pixels, palette, palette_len))
goto error;
}
break;
case MPNG_CHUNK_TRNS:
{
if (format != FMT_ARGB8888 || !pixels || pixels != pixelsat)
goto error;
@ -259,7 +256,6 @@ bool png_decode(const void *userdata, size_t len,
goto error;
else
goto error;
}
break;
case MPNG_CHUNK_IDAT:
{
@ -335,6 +331,9 @@ bool png_decode(const void *userdata, size_t len,
out = (uint8_t*)malloc(videofmt_byte_per_pixel(format) * ihdr.width * ihdr.height);
if (!out)
goto error;
/* TODO: deinterlace at random point */
/* run filters */