]> git.cameronkatri.com Git - mandoc.git/blobdiff - main.c
If no output device was allocated because no file wanted to produce output,
[mandoc.git] / main.c
diff --git a/main.c b/main.c
index f21279da1ddc7b44b5227007d153b37dd3b4e200..b03ba0737bf54df0029a0f16d76f869275ba33b1 100644 (file)
--- a/main.c
+++ b/main.c
@@ -1,4 +1,4 @@
-/*     $Id: main.c,v 1.250 2015/10/19 19:51:22 schwarze Exp $ */
+/*     $Id: main.c,v 1.252 2015/10/22 21:03:43 schwarze Exp $ */
 /*
  * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
  * Copyright (c) 2010-2012, 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -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();
@@ -696,6 +698,7 @@ parse(struct curparse *curp, int fd, const char *file)
        if (man == NULL)
                return;
        if (man->macroset == MACROSET_MDOC) {
+               mdoc_validate(man);
                switch (curp->outtype) {
                case OUTT_HTML:
                        html_mdoc(curp->outdata, man);