From 9953b888e25942fa632d3e754daa293a4239d4c5 Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Thu, 22 Oct 2015 21:03:43 +0000 Subject: If no output device was allocated because no file wanted to produce output, refrain from dereferencing a NULL pointer during final deallocation. Fixing a recent regression reported by czarkoff@ --- main.c | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/main.c b/main.c index d2549083..8ba7da50 100644 --- a/main.c +++ b/main.c @@ -466,21 +466,23 @@ main(int argc, char *argv[]) mparse_reset(curp.mp); } - switch (curp.outtype) { - case OUTT_HTML: - html_free(curp.outdata); - break; - case OUTT_UTF8: - case OUTT_LOCALE: - case OUTT_ASCII: - ascii_free(curp.outdata); - break; - case OUTT_PDF: - case OUTT_PS: - pspdf_free(curp.outdata); - break; - default: - break; + if (curp.outdata != NULL) { + switch (curp.outtype) { + case OUTT_HTML: + html_free(curp.outdata); + break; + case OUTT_UTF8: + case OUTT_LOCALE: + case OUTT_ASCII: + ascii_free(curp.outdata); + break; + case OUTT_PDF: + case OUTT_PS: + pspdf_free(curp.outdata); + break; + default: + break; + } } mparse_free(curp.mp); mchars_free(); -- cgit