From a8edb9b209d75b844165b041fc49e1db302d9c51 Mon Sep 17 00:00:00 2001 From: Sebastian Rasmussen Date: Sat, 29 Oct 2016 15:00:50 +0800 Subject: Plug pixmap leak when fz_convert_pixmap() throws. --- source/fitz/load-pnm.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'source/fitz/load-pnm.c') diff --git a/source/fitz/load-pnm.c b/source/fitz/load-pnm.c index 4c827e43..f724eb09 100644 --- a/source/fitz/load-pnm.c +++ b/source/fitz/load-pnm.c @@ -568,20 +568,20 @@ pam_binary_read_image(fz_context *ctx, struct info *pnm, unsigned char *p, unsig if (img->n > 4) { fz_pixmap *rgb = fz_new_pixmap(ctx, fz_device_rgb(ctx), img->w, img->h, 1); + rgb->xres = img->xres; rgb->yres = img->yres; fz_try(ctx) - { fz_convert_pixmap(ctx, rgb, img); - fz_drop_pixmap(ctx, img); - img = rgb; - rgb = NULL; - } - fz_always(ctx) - fz_drop_pixmap(ctx, rgb); fz_catch(ctx) + { + fz_drop_pixmap(ctx, rgb); fz_rethrow(ctx); + } + + fz_drop_pixmap(ctx, img); + img = rgb; } fz_premultiply_pixmap(ctx, img); -- cgit v1.2.3