From cc4dd0f8358d3de1594cc530b8f2691bccf194f0 Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Fri, 23 Dec 2011 11:20:16 +0000 Subject: Add some fz_vars to fix exception behaviour. gcc 4.4.5 gives helpful warnings about variables that can become unset due to setjmp/longjmp usage. Fix that here. Thanks to Sebras. --- pdf/pdf_type3.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'pdf/pdf_type3.c') diff --git a/pdf/pdf_type3.c b/pdf/pdf_type3.c index c63a2642..730a2754 100644 --- a/pdf/pdf_type3.c +++ b/pdf/pdf_type3.c @@ -12,7 +12,7 @@ pdf_load_type3_font(pdf_xref *xref, fz_obj *rdb, fz_obj *dict) { char buf[256]; char *estrings[256]; - pdf_font_desc *fontdesc; + pdf_font_desc *fontdesc = NULL; fz_obj *encoding; fz_obj *widths; fz_obj *charprocs; @@ -23,6 +23,8 @@ pdf_load_type3_font(pdf_xref *xref, fz_obj *rdb, fz_obj *dict) fz_matrix matrix; fz_context *ctx = xref->ctx; + fz_var(fontdesc); + fz_try(ctx) { obj = fz_dict_gets(dict, "Name"); @@ -148,7 +150,8 @@ pdf_load_type3_font(pdf_xref *xref, fz_obj *rdb, fz_obj *dict) } fz_catch(ctx) { - fz_drop_font(ctx, fontdesc->font); + if (fontdesc) + fz_drop_font(ctx, fontdesc->font); fz_free(ctx, fontdesc); fz_throw(ctx, "cannot load type3 font (%d %d R)", fz_to_num(dict), fz_to_gen(dict)); } -- cgit v1.2.3