aboutsummaryrefslogtreecommitdiffstats
path: root/src/lua/lua_config.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-09-27 12:47:08 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-09-27 12:47:08 +0100
commitca03fc2cc1d45800da06820eb55bb30d493a2aa8 (patch)
treea2e565a21b3e4490b90e2e702700edfcf2b5e364 /src/lua/lua_config.c
parentc408720e08599ffecadaf1db2506d0afb5e72692 (diff)
downloadrspamd-ca03fc2cc1d45800da06820eb55bb30d493a2aa8.tar.gz
rspamd-ca03fc2cc1d45800da06820eb55bb30d493a2aa8.zip
[Minor] Fix various static leaks
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);