aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2011-12-25 19:31:25 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2011-12-25 19:31:25 +0000
commitca227bf5f3d09e4e0e8db2c2931780855601912a (patch)
treedfa577d087d3d10cb63ba7351e622a663ba32908
parentc8d73e251047e8859a65f91c95d63ae37f97e1a6 (diff)
downloadmandoc-ca227bf5f3d09e4e0e8db2c2931780855601912a.tar.gz
mandoc-ca227bf5f3d09e4e0e8db2c2931780855601912a.tar.zst
mandoc-ca227bf5f3d09e4e0e8db2c2931780855601912a.zip
First memory leak in mandocdb.c freeing "struct of". Also properly
const-ify several strings.
-rw-r--r--mandocdb.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/mandocdb.c b/mandocdb.c
index 04495315..cf92d6dd 100644
--- a/mandocdb.c
+++ b/mandocdb.c
@@ -1,4 +1,4 @@
-/* $Id: mandocdb.c,v 1.40 2011/12/25 16:53:51 schwarze Exp $ */
+/* $Id: mandocdb.c,v 1.41 2011/12/25 19:31:25 kristaps Exp $ */
/*
* Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011 Ingo Schwarze <schwarze@openbsd.org>
@@ -1452,7 +1452,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;
@@ -1756,6 +1757,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;
@@ -1774,7 +1776,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);