Create png_reverse_filter_deinit

This commit is contained in:
twinaphex 2015-02-25 20:36:54 +01:00
parent 0c29342fd6
commit ef09b9a855

View File

@ -89,6 +89,14 @@ static void deinterlace_pass(uint32_t *data, const struct png_ihdr *ihdr,
}
}
static void png_reverse_filter_deinit(struct rpng_process_t *pngp)
{
if (pngp->decoded_scanline)
free(pngp->decoded_scanline);
if (pngp->prev_scanline)
free(pngp->prev_scanline);
}
static bool png_reverse_filter_init(uint32_t *data, const struct png_ihdr *ihdr,
struct rpng_process_t *pngp)
{
@ -105,8 +113,7 @@ static bool png_reverse_filter_init(uint32_t *data, const struct png_ihdr *ihdr,
if (!pngp->prev_scanline || !pngp->decoded_scanline)
{
free(pngp->decoded_scanline);
free(pngp->prev_scanline);
png_reverse_filter_deinit(pngp);
return false;
}
@ -186,10 +193,7 @@ static bool png_reverse_filter(uint32_t *data, const struct png_ihdr *ihdr,
}
end:
if (pngp->decoded_scanline)
free(pngp->decoded_scanline);
if (pngp->prev_scanline)
free(pngp->prev_scanline);
png_reverse_filter_deinit(pngp);
return ret;
}