aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/client/rspamc.c2
-rw-r--r--src/libserver/cfg_rcl.c3
-rw-r--r--src/lua/lua_config.c7
-rw-r--r--src/lua/lua_util.c1
4 files changed, 11 insertions, 2 deletions
diff --git a/src/client/rspamc.c b/src/client/rspamc.c
index 303669405..3f637cda0 100644
--- a/src/client/rspamc.c
+++ b/src/client/rspamc.c
@@ -411,6 +411,7 @@ read_cmd_line (gint *argc, gchar ***argv)
/* 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);
}
@@ -418,6 +419,7 @@ read_cmd_line (gint *argc, gchar ***argv)
raw = TRUE;
}
/* Argc and argv are shifted after this function */
+ g_option_context_free (context);
}
static gboolean
diff --git a/src/libserver/cfg_rcl.c b/src/libserver/cfg_rcl.c
index 04bd9eefc..b219e1af8 100644
--- a/src/libserver/cfg_rcl.c
+++ b/src/libserver/cfg_rcl.c
@@ -3932,6 +3932,9 @@ rspamd_config_read (struct rspamd_config *cfg,
}
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;
}
diff --git a/src/lua/lua_config.c b/src/lua/lua_config.c
index 5c914af79..f047f1530 100644
--- a/src/lua/lua_config.c
+++ b/src/lua/lua_config.c
@@ -4157,7 +4157,12 @@ lua_config_init_subsystem (lua_State *L)
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);
diff --git a/src/lua/lua_util.c b/src/lua/lua_util.c
index f86f975e7..026e6e822 100644
--- a/src/lua/lua_util.c
+++ b/src/lua/lua_util.c
@@ -822,7 +822,6 @@ lua_util_config_from_ucl (lua_State *L)
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)) {