diff options
author | Kristaps Dzonsons <kristaps@bsd.lv> | 2011-12-10 21:46:59 +0000 |
---|---|---|
committer | Kristaps Dzonsons <kristaps@bsd.lv> | 2011-12-10 21:46:59 +0000 |
commit | 8220e531c4f54a919e401e77e97f5b01f05074f0 (patch) | |
tree | 9eb37d187272e096b7608167f509daa1920cf363 /apropos_db.c | |
parent | dfc7327f4f68a2114a1ee5a65c95267a70fccbbc (diff) | |
download | mandoc-8220e531c4f54a919e401e77e97f5b01f05074f0.tar.gz mandoc-8220e531c4f54a919e401e77e97f5b01f05074f0.tar.zst mandoc-8220e531c4f54a919e401e77e97f5b01f05074f0.zip |
Plug a memory leak in single_search().
Diffstat (limited to 'apropos_db.c')
-rw-r--r-- | apropos_db.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/apropos_db.c b/apropos_db.c index 3eca9874..fd657558 100644 --- a/apropos_db.c +++ b/apropos_db.c @@ -1,4 +1,4 @@ -/* $Id: apropos_db.c,v 1.22 2011/12/09 11:18:57 kristaps Exp $ */ +/* $Id: apropos_db.c,v 1.23 2011/12/10 21:46:59 kristaps Exp $ */ /* * Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2011 Ingo Schwarze <schwarze@openbsd.org> @@ -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); } |