summaryrefslogtreecommitdiffstats
path: root/demandoc.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2022-04-14 16:43:43 +0000
committerIngo Schwarze <schwarze@openbsd.org>2022-04-14 16:43:43 +0000
commitbddcaddd71aa306d9c5a606bc7ece6e2812925c5 (patch)
treecacfd28f1b6b5861bfa32dfeb9551fabcb76bf3c /demandoc.c
parent525559c24a4e02693f443d611b8920564a497f85 (diff)
downloadmandoc-bddcaddd71aa306d9c5a606bc7ece6e2812925c5.tar.gz
support for hunting memory leaks;
designed and written last autumn, polished today
Diffstat (limited to 'demandoc.c')
-rw-r--r--demandoc.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/demandoc.c b/demandoc.c
index 6ff1c232..e22aa6b5 100644
--- a/demandoc.c
+++ b/demandoc.c
@@ -1,4 +1,4 @@
-/* $Id$ */
+/* $Id$ */
/*
* Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -26,6 +26,10 @@
#include <unistd.h>
#include "mandoc.h"
+#if DEBUG_MEMORY
+#define DEBUG_NODEF
+#include "mandoc_dbg.h"
+#endif
#include "roff.h"
#include "man.h"
#include "mdoc.h"
@@ -47,6 +51,10 @@ main(int argc, char *argv[])
int ch, fd, i, list;
extern int optind;
+#if DEBUG_MEMORY
+ mandoc_dbg_init(argc, argv);
+#endif
+
if (argc < 1)
progname = "demandoc";
else if ((progname = strrchr(argv[0], '/')) == NULL)
@@ -97,6 +105,9 @@ main(int argc, char *argv[])
mparse_free(mp);
mchars_free();
+#if DEBUG_MEMORY
+ mandoc_dbg_finish();
+#endif
return (int)MANDOCLEVEL_OK;
}