source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: If no output device was allocated because no file wanted to
@ 2015-10-22 21:04 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2015-10-22 21:04 UTC (permalink / raw)
  To: source

Log Message:
-----------
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@

Modified Files:
--------------
    mdocml:
        main.c

Revision Data
-------------
Index: main.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/main.c,v
retrieving revision 1.251
retrieving revision 1.252
diff -Lmain.c -Lmain.c -u -p -r1.251 -r1.252
--- main.c
+++ 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();
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-10-22 21:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-22 21:04 mdocml: If no output device was allocated because no file wanted to schwarze

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).