From 61b6fcfd1226b6540c151c902f8b688545494736 Mon Sep 17 00:00:00 2001 From: Jonathan McDowell Date: Tue, 24 Mar 2009 20:47:43 +0000 Subject: [PATCH 1/1] Ensure DB4 backend dbconns memory is initialised to zero Change to using calloc to allocate the memory for the dbconns array, as this will ensure that all the pointers in it are NULL which prevents us segfaulting on abnormal cleanup. Fixes the segfault from Debian bug #520117 but not the underlying issue. --- keydb_db4.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keydb_db4.c b/keydb_db4.c index e9dd509..8990758 100644 --- a/keydb_db4.c +++ b/keydb_db4.c @@ -314,7 +314,7 @@ static void db4_initdb(bool readonly) } } - dbconns = malloc(sizeof (DB *) * numdbs); + dbconns = calloc(numdbs, sizeof (DB *)); if (dbconns == NULL) { logthing(LOGTHING_CRITICAL, "Couldn't allocate memory for dbconns"); -- 2.39.5