summaryrefslogtreecommitdiff
path: root/usr.bin/mandoc
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2011-12-25 19:57:21 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2011-12-25 19:57:21 +0000
commitf99849dad4b60ed7647259a193d77a554f5a00cc (patch)
tree251e877f31b20b0922a55a272d3f2f857302844d /usr.bin/mandoc
parent081eca43c58daf6ae1e54b5d4d76e0e2a753a262 (diff)
Plug a memleak and constify some strings; from kristaps@.
Diffstat (limited to 'usr.bin/mandoc')
-rw-r--r--usr.bin/mandoc/mandocdb.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/usr.bin/mandoc/mandocdb.c b/usr.bin/mandoc/mandocdb.c
index 73eac8ea10f..ae955d2a477 100644
--- a/usr.bin/mandoc/mandocdb.c
+++ b/usr.bin/mandoc/mandocdb.c
@@ -1,4 +1,4 @@
-/* $Id: mandocdb.c,v 1.30 2011/12/25 16:52:55 schwarze Exp $ */
+/* $Id: mandocdb.c,v 1.31 2011/12/25 19:57:20 schwarze Exp $ */
/*
* Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011 Ingo Schwarze <schwarze@openbsd.org>
@@ -1440,7 +1440,8 @@ static void
ofile_argbuild(int argc, char *argv[], struct of **of)
{
char buf[MAXPATHLEN];
- char *sec, *arch, *title, *p;
+ const char *sec, *arch, *title;
+ char *p;
int i, src_form;
struct of *nof;
@@ -1744,6 +1745,7 @@ ofile_dirbuild(const char *dir, const char* psec, const char *parch,
if (verb > 1)
printf("%s: scheduling\n", buf);
+
if (NULL == *of) {
*of = nof;
(*of)->first = nof;
@@ -1762,7 +1764,10 @@ ofile_free(struct of *of)
{
struct of *nof;
- while (of) {
+ if (NULL != of)
+ of = of->first;
+
+ while (NULL != of) {
nof = of->next;
free(of->fname);
free(of->sec);