summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source/fitz/image.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/source/fitz/image.c b/source/fitz/image.c
index 79f7bfee..db06b340 100644
--- a/source/fitz/image.c
+++ b/source/fitz/image.c
@@ -1119,6 +1119,8 @@ display_list_image_get_pixmap(fz_context *ctx, fz_image *image_, fz_irect *subar
fz_device *dev;
fz_pixmap *pix;
+ fz_var(dev);
+
if (subarea)
{
/* So, the whole image should be scaled to w * h, but we only want the
@@ -1142,16 +1144,19 @@ display_list_image_get_pixmap(fz_context *ctx, fz_image *image_, fz_irect *subar
ctm = fz_pre_scale(image->transform, w, h);
fz_clear_pixmap(ctx, pix); /* clear to transparent */
- dev = fz_new_draw_device(ctx, ctm, pix);
fz_try(ctx)
{
+ dev = fz_new_draw_device(ctx, ctm, pix);
fz_run_display_list(ctx, image->list, dev, fz_identity, fz_infinite_rect, NULL);
fz_close_device(ctx, dev);
}
fz_always(ctx)
fz_drop_device(ctx, dev);
fz_catch(ctx)
+ {
+ fz_drop_pixmap(ctx, pix);
fz_rethrow(ctx);
+ }
/* Never do more subsampling, cos we've already given them the right size */
if (l2factor)