/* Parse options */
if (!g_option_context_parse (context, argc, argv, &error)) {
fprintf (stderr, "option parsing failed: %s\n", error->message);
+ g_option_context_free (context);
exit (EXIT_FAILURE);
}
raw = TRUE;
}
/* Argc and argv are shifted after this function */
+ g_option_context_free (context);
}
static gboolean
}
cfg->lang_det = rspamd_language_detector_init (cfg);
+ rspamd_mempool_add_destructor (cfg->cfg_pool,
+ (rspamd_mempool_destruct_t)rspamd_language_detector_unref,
+ cfg->lang_det);
return TRUE;
}
rspamd_init_filters (cfg, FALSE);
}
else if (strcmp (parts[i], "langdet") == 0) {
- cfg->lang_det = rspamd_language_detector_init (cfg);
+ if (!cfg->lang_det) {
+ cfg->lang_det = rspamd_language_detector_init (cfg);
+ rspamd_mempool_add_destructor (cfg->cfg_pool,
+ (rspamd_mempool_destruct_t) rspamd_language_detector_unref,
+ cfg->lang_det);
+ }
}
else if (strcmp (parts[i], "stat") == 0) {
rspamd_stat_init (cfg, NULL);
cfg->lua_state = L;
cfg->rcl_obj = obj;
- cfg->cache = rspamd_symcache_new (cfg);
top = rspamd_rcl_config_init (cfg, NULL);
if (!rspamd_rcl_parse (top, cfg, cfg, cfg->cfg_pool, cfg->rcl_obj, &err)) {