From: Vsevolod Stakhov Date: Fri, 6 Feb 2009 17:25:44 +0000 (+0300) Subject: * Fill hash buckets with zeroes to avoid invalid pointer usage X-Git-Tag: 0.2.7~312 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=092996070fffeb3d6aabb1065d0382d7a24f604e;p=thirdparty%2Frspamd.git * Fill hash buckets with zeroes to avoid invalid pointer usage --- diff --git a/src/hash.c b/src/hash.c index 54791f8f23..5ba01e8bc4 100644 --- a/src/hash.c +++ b/src/hash.c @@ -157,7 +157,7 @@ rspamd_hash_new (memory_pool_t *pool, GHashFunc hash_func, GEqualFunc key_equal_ hash->nnodes = 0; hash->hash_func = hash_func ? hash_func : g_direct_hash; hash->key_equal_func = key_equal_func; - hash->nodes = memory_pool_alloc (pool, sizeof (struct rspamd_hash_node*) * hash->size); + hash->nodes = memory_pool_alloc0 (pool, sizeof (struct rspamd_hash_node*) * hash->size); hash->shared = 0; hash->pool = pool; @@ -177,7 +177,7 @@ rspamd_hash_new_shared (memory_pool_t *pool, GHashFunc hash_func, GEqualFunc key hash->nnodes = 0; hash->hash_func = hash_func ? hash_func : g_direct_hash; hash->key_equal_func = key_equal_func; - hash->nodes = memory_pool_alloc (pool, sizeof (struct rspamd_hash_node*) * hash->size); + hash->nodes = memory_pool_alloc0 (pool, sizeof (struct rspamd_hash_node*) * hash->size); hash->shared = 1; /* Get mutex from pool for locking on insert/remove operations */ hash->lock = memory_pool_get_rwlock (pool);