summaryrefslogtreecommitdiffstats
path: root/apropos_db.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2011-12-10 21:46:59 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2011-12-10 21:46:59 +0000
commitb2f62a9dfad85b17622ada01e540d1dfe412b637 (patch)
tree1c2f078345a959473628b1a60b4562f6c5704b10 /apropos_db.c
parent51947e6b3e08cfaae752bef72751eef476633755 (diff)
downloadmandoc-b2f62a9dfad85b17622ada01e540d1dfe412b637.tar.gz
Plug a memory leak in single_search().
Diffstat (limited to 'apropos_db.c')
-rw-r--r--apropos_db.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/apropos_db.c b/apropos_db.c
index 36afaf47..7684f27e 100644
--- a/apropos_db.c
+++ b/apropos_db.c
@@ -550,6 +550,7 @@ single_search(struct rectree *tree, const struct opts *opts,
(rs, (tree->len + 1) * sizeof(struct rec));
memcpy(&rs[tree->len], &r, sizeof(struct rec));
+ memset(&r, 0, sizeof(struct rec));
rs[tree->len].matches =
mandoc_calloc(terms, sizeof(int));
@@ -565,7 +566,6 @@ single_search(struct rectree *tree, const struct opts *opts,
} else
root = tree->len;
- memset(&r, 0, sizeof(struct rec));
tree->len++;
}
@@ -573,6 +573,7 @@ single_search(struct rectree *tree, const struct opts *opts,
(*idx->close)(idx);
free(buf);
+ recfree(&r);
return(1 == ch);
}