summaryrefslogtreecommitdiffstats
path: root/mandocdb.c
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
commit6a77081b4e30b2766639dbf6e063db437049632b (patch)
tree5224c4d9aa866b9c700c665dc3e03023a05f1cbd /mandocdb.c
parent2008dee5c827764c4952cdd2279b165f6b5cfb33 (diff)
downloadmandoc-6a77081b4e30b2766639dbf6e063db437049632b.tar.gz
First memory leak in mandocdb.c freeing "struct of". Also properly
const-ify several strings.
Diffstat (limited to 'mandocdb.c')
-rw-r--r--mandocdb.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/mandocdb.c b/mandocdb.c
index 7231bfb7..fa59d564 100644
--- a/mandocdb.c
+++ b/mandocdb.c
@@ -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);