From: schwarze Date: Fri, 2 Jan 2015 17:01:31 +0000 (+0000) Subject: Explicitly set the *data member of struct ohash_info to NULL. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=bd9c2e4840d14a7bb8b04c9c1239f9b9f662b066;p=openbsd Explicitly set the *data member of struct ohash_info to NULL. It is never dereferenced, but it gets copied around, which worries static analysis tools and might also confuse human auditors. FreeBSD Coverity CID 1261298, 1261299, 1261300, reported by Pedro Giffuni and Ulrich Spörlein . --- diff --git a/usr.bin/mandoc/mandocdb.c b/usr.bin/mandoc/mandocdb.c index 0ffbd15b602..544e1ffe110 100644 --- a/usr.bin/mandoc/mandocdb.c +++ b/usr.bin/mandoc/mandocdb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mandocdb.c,v 1.134 2014/12/30 20:40:05 schwarze Exp $ */ +/* $OpenBSD: mandocdb.c,v 1.135 2015/01/02 17:01:31 schwarze Exp $ */ /* * Copyright (c) 2011, 2012 Kristaps Dzonsons * Copyright (c) 2011, 2012, 2013, 2014 Ingo Schwarze @@ -340,7 +340,8 @@ mandocdb(int argc, char *argv[]) mpages_info.alloc = mlinks_info.alloc = hash_alloc; mpages_info.calloc = mlinks_info.calloc = hash_calloc; - mpages_info.free = mlinks_info.free = hash_free; + mpages_info.free = mlinks_info.free = hash_free; + mpages_info.data = mlinks_info.data = NULL; mpages_info.key_offset = offsetof(struct mpage, inodev); mlinks_info.key_offset = offsetof(struct mlink, file); @@ -1096,6 +1097,7 @@ mpages_merge(struct mparse *mp) str_info.alloc = hash_alloc; str_info.calloc = hash_calloc; str_info.free = hash_free; + str_info.data = NULL; str_info.key_offset = offsetof(struct str, key); if ( ! nodb)