From ffb37aaa386095d61846419c860eb46b587b6b1d Mon Sep 17 00:00:00 2001 From: Sebastian Rasmussen Date: Sat, 4 Aug 2012 19:35:39 +0200 Subject: Make use of fz_always instead of repeating code for error and normal path --- apps/mudraw.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'apps') diff --git a/apps/mudraw.c b/apps/mudraw.c index dcd7dafd..0f11a7a1 100644 --- a/apps/mudraw.c +++ b/apps/mudraw.c @@ -130,15 +130,17 @@ static void drawpage(fz_context *ctx, fz_document *doc, int pagenum) dev = fz_new_list_device(ctx, list); fz_run_page(doc, page, dev, fz_identity, &cookie); } - fz_catch(ctx) + fz_always(ctx) { fz_free_device(dev); + dev = NULL; + } + fz_catch(ctx) + { fz_free_display_list(ctx, list); fz_free_page(doc, page); fz_throw(ctx, "cannot draw page %d in file '%s'", pagenum, filename); } - fz_free_device(dev); - dev = NULL; } if (showxml) -- cgit v1.2.3