From 347a46329722cb05d2b968e749773a1d0c2594ca Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Fri, 10 Oct 2014 22:18:37 +0100 Subject: [PATCH] Fix inserting to the hash. --- src/libserver/symbols_cache.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/libserver/symbols_cache.c b/src/libserver/symbols_cache.c index f40847bd3..a50462a0c 100644 --- a/src/libserver/symbols_cache.c +++ b/src/libserver/symbols_cache.c @@ -378,8 +378,12 @@ register_symbol_common (struct symbols_cache **cache, skipped = FALSE; item->s->weight = weight * (m->unknown_weight); + s = rspamd_mempool_alloc0 (pcache->static_pool, + sizeof (*s)); + s->name = item->s->symbol; + s->weight_ptr = &item->s->weight; g_hash_table_insert (m->symbols, item->s->symbol, - &item->s->weight); + s); mlist = g_hash_table_lookup (pcache->cfg->metrics_symbols, name); mlist = g_list_prepend (mlist, m); g_hash_table_insert (pcache->cfg->metrics_symbols, -- 2.39.5