summaryrefslogtreecommitdiffstats
path: root/src/plugins/dkim_check.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-01-17 19:19:47 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-01-17 19:19:47 +0000
commit7d40df5184f0aa6facde77e088d0751d4c475c6a (patch)
tree8c54b8eb817da0dee480bebd66d46bd83ee73898 /src/plugins/dkim_check.c
parent6eec897d8c3e01159556f41b8bb938cacfc0c084 (diff)
downloadrspamd-7d40df5184f0aa6facde77e088d0751d4c475c6a.tar.gz
rspamd-7d40df5184f0aa6facde77e088d0751d4c475c6a.zip
[Fix] Various reload leak fixing
Diffstat (limited to 'src/plugins/dkim_check.c')
-rw-r--r--src/plugins/dkim_check.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/plugins/dkim_check.c b/src/plugins/dkim_check.c
index 6b10b2aa9..aa2da3bfe 100644
--- a/src/plugins/dkim_check.c
+++ b/src/plugins/dkim_check.c
@@ -502,6 +502,9 @@ dkim_module_config (struct rspamd_config *cfg)
if (lua_type (cfg->lua_state, -1) == LUA_TFUNCTION) {
dkim_module_ctx->sign_condition_ref = luaL_ref (cfg->lua_state,
LUA_REGISTRYINDEX);
+ rspamd_lua_add_ref_dtor (cfg->lua_state,
+ dkim_module_ctx->dkim_pool,
+ dkim_module_ctx->sign_condition_ref);
dkim_module_ctx->dkim_sign_hash = rspamd_lru_hash_new (
128,
@@ -631,10 +634,19 @@ dkim_module_reconfig (struct rspamd_config *cfg)
saved_ctx = dkim_module_ctx->ctx;
rspamd_mempool_delete (dkim_module_ctx->dkim_pool);
radix_destroy_compressed (dkim_module_ctx->whitelist_ip);
+
if (dkim_module_ctx->dkim_domains) {
g_hash_table_destroy (dkim_module_ctx->dkim_domains);
}
+ if (dkim_module_ctx->dkim_hash) {
+ rspamd_lru_hash_destroy (dkim_module_ctx->dkim_hash);
+ }
+
+ if (dkim_module_ctx->dkim_sign_hash) {
+ rspamd_lru_hash_destroy (dkim_module_ctx->dkim_sign_hash);
+ }
+
memset (dkim_module_ctx, 0, sizeof (*dkim_module_ctx));
dkim_module_ctx->ctx = saved_ctx;
dkim_module_ctx->dkim_pool = rspamd_mempool_new (rspamd_mempool_suggest_size (), "dkim");