diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2009-02-06 20:25:44 +0300 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2009-02-06 20:25:44 +0300 |
commit | 092996070fffeb3d6aabb1065d0382d7a24f604e (patch) | |
tree | ce2f05bc68db3308bbfc3b771b9024fb5f1bef60 /src/hash.c | |
parent | acec2b42286f734eacb7bab14d7d20e1110f4545 (diff) | |
download | rspamd-092996070fffeb3d6aabb1065d0382d7a24f604e.tar.gz rspamd-092996070fffeb3d6aabb1065d0382d7a24f604e.zip |
* Fill hash buckets with zeroes to avoid invalid pointer usage
Diffstat (limited to 'src/hash.c')
-rw-r--r-- | src/hash.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/hash.c b/src/hash.c index 54791f8f2..5ba01e8bc 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); |