summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Rasmussen <sebras@gmail.com>2016-10-16 04:05:21 +0800
committerSebastian Rasmussen <sebras@gmail.com>2016-10-16 12:51:27 +0800
commitb63de11e04e17c7243761dabf4559e6088cb420e (patch)
treef85b14ac8e9be2069fd7f2ea922ec684dc8e1f4d
parent1528a5955b0c1ab8ff07281d67cbc8d6a39ff203 (diff)
downloadmupdf-b63de11e04e17c7243761dabf4559e6088cb420e.tar.xz
tiff: Plug pixmap leak should conversion fail.
-rw-r--r--source/fitz/load-tiff.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/source/fitz/load-tiff.c b/source/fitz/load-tiff.c
index 2e235c94..86f1d203 100644
--- a/source/fitz/load-tiff.c
+++ b/source/fitz/load-tiff.c
@@ -1099,12 +1099,23 @@ fz_load_tiff_subimage(fz_context *ctx, unsigned char *buf, size_t len, int subim
if (image->n == 5)
{
fz_pixmap *rgb = fz_new_pixmap(ctx, fz_device_rgb(ctx), image->w, image->h, 1);
- fz_convert_pixmap(ctx, rgb, image);
- rgb->xres = image->xres;
- rgb->yres = image->yres;
- fz_drop_pixmap(ctx, image);
- image = rgb;
+
+ fz_try(ctx)
+ {
+ fz_pixmap *rgb = fz_new_pixmap(ctx, fz_device_rgb(ctx), image->w, image->h, 1);
+ 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_rethrow(ctx);
}
+
fz_premultiply_pixmap(ctx, image);
}
}