diff options
author | Sebastian Rasmussen <sebras@gmail.com> | 2017-06-12 08:22:39 +0800 |
---|---|---|
committer | Sebastian Rasmussen <sebras@gmail.com> | 2017-06-16 23:46:08 +0800 |
commit | f7a0321c03fde85aab74a09b5770277915a7f274 (patch) | |
tree | 6e7159c14de0c39d8952574d59c8c3cbc36ec4b1 /source/fitz | |
parent | a7cb220f3f979462f1e010cd968ad06fd5294f67 (diff) | |
download | mupdf-f7a0321c03fde85aab74a09b5770277915a7f274.tar.xz |
Drop type 3 glyph pixmap in case of error.
Diffstat (limited to 'source/fitz')
-rw-r--r-- | source/fitz/font.c | 8 |
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); } |