From fd34e65f68a612e097611d261616457ce2e91966 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Wed, 22 Dec 2010 17:25:51 +0300 Subject: [PATCH] Init cache before loading config. --- src/cfg_xml.c | 1 - src/main.c | 10 ++++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/cfg_xml.c b/src/cfg_xml.c index 70f3ebda8..389298e4a 100644 --- a/src/cfg_xml.c +++ b/src/cfg_xml.c @@ -1023,7 +1023,6 @@ handle_composite (struct config_file *cfg, struct rspamd_xml_userdata *ctx, GHas return FALSE; } g_hash_table_insert (cfg->composite_symbols, val, expr); - register_virtual_symbol (&cfg->cache, val, 1); return TRUE; } diff --git a/src/main.c b/src/main.c index 72a7b6eac..14a4988ee 100644 --- a/src/main.c +++ b/src/main.c @@ -829,6 +829,12 @@ main (gint argc, gchar **argv, gchar **env) register_classifier_opt ("winnow", "min_tokens"); register_classifier_opt ("winnow", "learn_threshold"); + /* Pre-init of cache */ + rspamd->cfg->cache = g_new0 (struct symbols_cache, 1); + rspamd->cfg->cache->static_pool = memory_pool_new (memory_pool_get_size ()); + rspamd->cfg->cache->cfg = rspamd->cfg; + + /* Load config */ if (! load_rspamd_config (rspamd->cfg, TRUE)) { exit (EXIT_FAILURE); } @@ -837,10 +843,6 @@ main (gint argc, gchar **argv, gchar **env) if (is_debug) { rspamd->cfg->log_level = G_LOG_LEVEL_DEBUG; } - /* Pre-init of cache */ - rspamd->cfg->cache = g_new0 (struct symbols_cache, 1); - rspamd->cfg->cache->static_pool = memory_pool_new (memory_pool_get_size ()); - rspamd->cfg->cache->cfg = rspamd->cfg; if (rspamd->cfg->config_test || dump_vars || dump_cache) { /* Init events to test modules */ -- 2.39.5