summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ghostscript.com>2008-08-14 18:50:06 +0200
committerTor Andersson <tor@ghostscript.com>2008-08-14 18:50:06 +0200
commiteebde7c77fe76fcd91b670c0430aefbc9defc4b1 (patch)
treecaa76350dcebccefa7f355221c2bb1341099ed25
parentd6772127b1b12e4aff121b4a0c66c00c5a46e108 (diff)
downloadmupdf-eebde7c77fe76fcd91b670c0430aefbc9defc4b1.tar.xz
clean up global state on abort in pdftool (kjk)
-rw-r--r--apps/pdftool.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/apps/pdftool.c b/apps/pdftool.c
index b2db6d8b..15e77ad0 100644
--- a/apps/pdftool.c
+++ b/apps/pdftool.c
@@ -18,6 +18,10 @@
#include <sys/time.h>
#endif
+/* put these up here so we can clean up in die() */
+fz_renderer *drawgc = nil;
+void closesrc(void);
+
/*
* Common operations.
* Parse page selectors.
@@ -36,6 +40,9 @@ void die(fz_error *eo)
fz_printerror(eo);
fz_droperror(eo);
fflush(stderr);
+ if (drawgc)
+ fz_droprenderer(drawgc);
+ closesrc();
abort();
}
@@ -478,7 +485,6 @@ struct benchmark
int maxpage;
};
-fz_renderer *drawgc = nil;
int drawmode = DRAWPNM;
char *drawpattern = nil;
pdf_page *drawpage = nil;