summaryrefslogtreecommitdiffstats
path: root/mandocd.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 /mandocd.c
parent525559c24a4e02693f443d611b8920564a497f85 (diff)
downloadmandoc-bddcaddd71aa306d9c5a606bc7ece6e2812925c5.tar.gz
support for hunting memory leaks;
designed and written last autumn, polished today
Diffstat (limited to 'mandocd.c')
-rw-r--r--mandocd.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/mandocd.c b/mandocd.c
index 9d07857c..10919929 100644
--- a/mandocd.c
+++ b/mandocd.c
@@ -1,7 +1,7 @@
-/* $Id$ */
+/* $Id$ */
/*
* Copyright (c) 2017 Michael Stapelberg <stapelberg@debian.org>
- * Copyright (c) 2017, 2019 Ingo Schwarze <schwarze@openbsd.org>
+ * Copyright (c) 2017, 2019, 2021 Ingo Schwarze <schwarze@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -35,6 +35,10 @@
#include <unistd.h>
#include "mandoc.h"
+#if DEBUG_MEMORY
+#define DEBUG_NODEF 1
+#include "mandoc_dbg.h"
+#endif
#include "roff.h"
#include "mdoc.h"
#include "man.h"
@@ -129,6 +133,10 @@ main(int argc, char *argv[])
int state, opt;
enum outt outtype;
+#if DEBUG_MEMORY
+ mandoc_dbg_init(argc, argv);
+#endif
+
defos = NULL;
outtype = OUTT_ASCII;
while ((opt = getopt(argc, argv, "I:T:")) != -1) {
@@ -240,6 +248,9 @@ main(int argc, char *argv[])
}
mparse_free(parser);
mchars_free();
+#if DEBUG_MEMORY
+ mandoc_dbg_finish();
+#endif
return state == -1 ? 1 : 0;
}