cfg->max_diff = 20480;
cfg->metrics = g_hash_table_new (rspamd_str_hash, rspamd_str_equal);
- cfg->c_modules = g_hash_table_new (rspamd_str_hash, rspamd_str_equal);
+ if (cfg->c_modules == NULL) {
+ cfg->c_modules = g_hash_table_new (rspamd_str_hash, rspamd_str_equal);
+ }
cfg->composite_symbols =
g_hash_table_new (rspamd_str_hash, rspamd_str_equal);
cfg->classifiers_symbols = g_hash_table_new (rspamd_str_hash,
ucl_obj_unref (cfg->rcl_obj);
g_hash_table_remove_all (cfg->metrics);
g_hash_table_unref (cfg->metrics);
- g_hash_table_remove_all (cfg->c_modules);
g_hash_table_unref (cfg->c_modules);
g_hash_table_remove_all (cfg->composite_symbols);
g_hash_table_unref (cfg->composite_symbols);
/* Save some variables */
tmp_cfg->cfg_name = cfg_file;
+ tmp_cfg->c_modules = g_hash_table_ref (rspamd->cfg->c_modules);
+
if (!load_rspamd_config (tmp_cfg, FALSE)) {
rspamd_set_logger (rspamd_main->cfg, g_quark_try_string (
"main"), rspamd_main);
while (l) {
filt = l->data;
if (filt->module) {
- cur_module =
- rspamd_mempool_alloc (cfg->cfg_pool,
- sizeof (struct module_ctx));
+ cur_module = g_slice_alloc0 (sizeof (struct module_ctx));
if (filt->module->module_init_func (cfg, &cur_module) == 0) {
g_hash_table_insert (cfg->c_modules,
(gpointer) filt->module->name,