diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2015-10-22 21:03:43 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2015-10-22 21:03:43 +0000 |
commit | 9953b888e25942fa632d3e754daa293a4239d4c5 (patch) | |
tree | 9912c41a7c1f1bb11135b4df96e9c3fb1fc300b8 | |
parent | ddefce3b76421a0191621f40623ba04fd510db65 (diff) | |
download | mandoc-9953b888e25942fa632d3e754daa293a4239d4c5.tar.gz |
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@
-rw-r--r-- | main.c | 32 |
1 files changed, 17 insertions, 15 deletions
@@ -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(); |