summaryrefslogtreecommitdiff
path: root/source/fitz/load-pnm.c
diff options
context:
space:
mode:
authorSebastian Rasmussen <sebras@gmail.com>2016-10-29 15:00:50 +0800
committerSebastian Rasmussen <sebras@gmail.com>2016-12-14 18:44:40 +0100
commita8edb9b209d75b844165b041fc49e1db302d9c51 (patch)
tree9031cf7245087dcf6e2ea286d4b417c2e3679db8 /source/fitz/load-pnm.c
parentf2e8dfeb3d4ccdcdbdf8e2e122883b0ec7145bc6 (diff)
downloadmupdf-a8edb9b209d75b844165b041fc49e1db302d9c51.tar.xz
Plug pixmap leak when fz_convert_pixmap() throws.
Diffstat (limited to 'source/fitz/load-pnm.c')
-rw-r--r--source/fitz/load-pnm.c14
1 files changed, 7 insertions, 7 deletions
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);