summaryrefslogtreecommitdiff
path: root/source/pdf/pdf-image.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/pdf/pdf-image.c
parentf2e8dfeb3d4ccdcdbdf8e2e122883b0ec7145bc6 (diff)
downloadmupdf-a8edb9b209d75b844165b041fc49e1db302d9c51.tar.xz
Plug pixmap leak when fz_convert_pixmap() throws.
Diffstat (limited to 'source/pdf/pdf-image.c')
-rw-r--r--source/pdf/pdf-image.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/source/pdf/pdf-image.c b/source/pdf/pdf-image.c
index b669948b..141ee171 100644
--- a/source/pdf/pdf-image.c
+++ b/source/pdf/pdf-image.c
@@ -47,7 +47,15 @@ pdf_load_image_imp(fz_context *ctx, pdf_document *doc, pdf_obj *rdb, pdf_obj *di
if (tile->n != 2)
fz_warn(ctx, "soft mask should be grayscale");
gray = fz_new_pixmap_with_bbox(ctx, fz_device_gray(ctx), fz_pixmap_bbox(ctx, tile, &bbox), 0);
- fz_convert_pixmap(ctx, gray, tile);
+
+ fz_try(ctx)
+ fz_convert_pixmap(ctx, gray, tile);
+ fz_catch(ctx)
+ {
+ fz_drop_pixmap(ctx, gray);
+ fz_rethrow(ctx);
+ }
+
fz_drop_pixmap(ctx, tile);
tile = gray;
}