From 4f73f6a6dfc0d65aa9a5055683bf7baa5a7b622e Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Fri, 3 Sep 2010 22:28:43 +0930 Subject: [PATCH] tdb2: make valgrind happier. --- ccan/tdb2/tdb.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ccan/tdb2/tdb.c b/ccan/tdb2/tdb.c index 54ab06b8..40811c2e 100644 --- a/ccan/tdb2/tdb.c +++ b/ccan/tdb2/tdb.c @@ -185,6 +185,9 @@ static int tdb_new_database(struct tdb_context *tdb) newdb.h.free[bucket] = offsetof(struct new_database, h.frec); newdb.h.frec.next = newdb.h.frec.prev = 0; + /* Clear free space to keep valgrind happy, and avoid leaking stack. */ + memset(newdb.space, 0, sizeof(newdb.space)); + /* Tailer contains maximum number of free_zone bits. */ newdb.tailer = INITIAL_ZONE_BITS; -- 2.39.2