summaryrefslogtreecommitdiffstats
path: root/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'main.c')
-rw-r--r--main.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/main.c b/main.c
index 8f190960..b200bc4e 100644
--- a/main.c
+++ b/main.c
@@ -220,6 +220,8 @@ main(int argc, char *argv[])
if (fflags & IGN_MACRO)
pflags |= MDOC_IGN_MACRO;
mdoc = mdoc_alloc(&curp, pflags, &mdoccb);
+ if (NULL == mdoc)
+ errx(1, "memory exhausted");
break;
}
@@ -246,8 +248,10 @@ main(int argc, char *argv[])
break;
if (man)
man_reset(man);
- if (mdoc)
- mdoc_reset(mdoc);
+ if (mdoc && ! mdoc_reset(mdoc)) {
+ warnx("memory exhausted");
+ break;
+ }
argv++;
}
rc = NULL == *argv;
@@ -273,8 +277,7 @@ version(void)
{
(void)printf("%s %s\n", __progname, VERSION);
- exit(0);
- /* NOTREACHED */
+ exit(EXIT_SUCCESS);
}
@@ -285,8 +288,7 @@ usage(void)
(void)fprintf(stderr, "usage: %s [-V] [-foption...] "
"[-mformat] [-Toutput] [-Werr...]\n",
__progname);
- exit(1);
- /* NOTREACHED */
+ exit(EXIT_FAILURE);
}