aboutsummaryrefslogtreecommitdiffstats
path: root/src/lua/lua_config.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lua/lua_config.c')
-rw-r--r--src/lua/lua_config.c7
1 files changed, 6 insertions, 1 deletions
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);