summaryrefslogtreecommitdiff
path: root/usr.bin/mandoc/mansearch.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2014-03-28 19:16:16 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2014-03-28 19:16:16 +0000
commit79770571a62fa1fb02453b23bc9b7d1127900d8c (patch)
tree3d10e5b755465f3b94566a8a010eae6f0018a946 /usr.bin/mandoc/mansearch.c
parent0be20948b974cef410915d76b7e5f6413cab5e2e (diff)
Properly initialize malloc(3)ed memory.
With this bug fix, partly unitialized memory could sometimes be returned, sometimes causing crashes by bogus free(3)s in apropos(1).
Diffstat (limited to 'usr.bin/mandoc/mansearch.c')
-rw-r--r--usr.bin/mandoc/mansearch.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/usr.bin/mandoc/mansearch.c b/usr.bin/mandoc/mansearch.c
index 1f0114ef06a..59b8d3c8ae7 100644
--- a/usr.bin/mandoc/mansearch.c
+++ b/usr.bin/mandoc/mansearch.c
@@ -1,4 +1,4 @@
-/* $Id: mansearch.c,v 1.15 2014/03/21 22:52:21 schwarze Exp $ */
+/* $Id: mansearch.c,v 1.16 2014/03/28 19:16:15 schwarze Exp $ */
/*
* Copyright (c) 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -302,6 +302,7 @@ buildnames(struct manpage *mpage, sqlite3 *db, sqlite3_stmt *s,
size_t i;
int c;
+ mpage->file = NULL;
mpage->names = NULL;
prevsec = prevarch = NULL;
i = 1;