From 8cb0a389794356d7b6624f78365a5e92efdeb8e8 Mon Sep 17 00:00:00 2001 From: Sebastian Rasmussen Date: Sun, 11 Jun 2017 23:11:42 +0800 Subject: Make sure to always drop a fz_device even upon error. --- source/fitz/stext-output.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'source/fitz/stext-output.c') diff --git a/source/fitz/stext-output.c b/source/fitz/stext-output.c index 63cd3c17..c2218357 100644 --- a/source/fitz/stext-output.c +++ b/source/fitz/stext-output.c @@ -471,8 +471,13 @@ static void text_end_page(fz_context *ctx, fz_document_writer *wri_, fz_device *dev) { fz_text_writer *wri = (fz_text_writer*)wri_; - fz_close_device(ctx, dev); - fz_drop_device(ctx, dev); + + fz_try(ctx) + fz_close_device(ctx, dev); + fz_always(ctx) + fz_drop_device(ctx, dev); + fz_catch(ctx) + fz_rethrow(ctx); switch (wri->format) { -- cgit v1.2.3