summaryrefslogtreecommitdiff
path: root/source/fitz/font.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/fitz/font.c')
-rw-r--r--source/fitz/font.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/source/fitz/font.c b/source/fitz/font.c
index 67f87828..77041dd8 100644
--- a/source/fitz/font.c
+++ b/source/fitz/font.c
@@ -1258,7 +1258,7 @@ fz_render_t3_glyph_pixmap(fz_context *ctx, fz_font *font, int gid, const fz_matr
fz_display_list *list;
fz_rect bounds;
fz_irect bbox;
- fz_device *dev;
+ fz_device *dev = NULL;
fz_pixmap *glyph;
fz_pixmap *result;
@@ -1292,11 +1292,12 @@ fz_render_t3_glyph_pixmap(fz_context *ctx, fz_font *font, int gid, const fz_matr
/* Glyphs must always have alpha */
glyph = fz_new_pixmap_with_bbox(ctx, model, &bbox, 1);
- fz_clear_pixmap(ctx, glyph);
- dev = fz_new_draw_device_type3(ctx, NULL, glyph);
+ fz_var(dev);
fz_try(ctx)
{
+ fz_clear_pixmap(ctx, glyph);
+ dev = fz_new_draw_device_type3(ctx, NULL, glyph);
fz_run_t3_glyph(ctx, font, gid, trm, dev);
fz_close_device(ctx, dev);
}
@@ -1306,6 +1307,7 @@ fz_render_t3_glyph_pixmap(fz_context *ctx, fz_font *font, int gid, const fz_matr
}
fz_catch(ctx)
{
+ fz_drop_pixmap(ctx, glyph);
fz_rethrow(ctx);
}