summaryrefslogtreecommitdiff
path: root/source/fitz/load-tiff.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-tiff.c
parentf2e8dfeb3d4ccdcdbdf8e2e122883b0ec7145bc6 (diff)
downloadmupdf-a8edb9b209d75b844165b041fc49e1db302d9c51.tar.xz
Plug pixmap leak when fz_convert_pixmap() throws.
Diffstat (limited to 'source/fitz/load-tiff.c')
-rw-r--r--source/fitz/load-tiff.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/source/fitz/load-tiff.c b/source/fitz/load-tiff.c
index 60b0e8a6..117b9816 100644
--- a/source/fitz/load-tiff.c
+++ b/source/fitz/load-tiff.c
@@ -1288,21 +1288,19 @@ fz_load_tiff_subimage(fz_context *ctx, unsigned char *buf, size_t len, int subim
{
fz_pixmap *rgb = fz_new_pixmap(ctx, fz_device_rgb(ctx), image->w, image->h, 1);
- fz_var(rgb);
+ rgb->xres = image->xres;
+ rgb->yres = image->yres;
fz_try(ctx)
- {
fz_convert_pixmap(ctx, rgb, image);
- rgb->xres = image->xres;
- rgb->yres = image->yres;
- fz_drop_pixmap(ctx, image);
- image = 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, image);
+ image = rgb;
}
fz_premultiply_pixmap(ctx, image);