]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Minor] Fix reload leak in dkim module
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 30 Jul 2018 17:07:17 +0000 (18:07 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 30 Jul 2018 17:07:17 +0000 (18:07 +0100)
src/plugins/dkim_check.c

index cfee44e8ce2d076632436944f1d1278c663d23ef..5439212143e1a2ff14a90b47d8de93f6410929a7 100644 (file)
@@ -65,7 +65,6 @@ struct dkim_ctx {
        const gchar *symbol_na;
        const gchar *symbol_permfail;
 
-       rspamd_mempool_t *dkim_pool;
        struct rspamd_radix_map_helper *whitelist_ip;
        struct rspamd_hash_map_helper *dkim_domains;
        guint strict_multiplier;
@@ -472,6 +471,13 @@ dkim_module_config (struct rspamd_config *cfg)
                        g_free,
                        (GDestroyNotify)rspamd_dkim_sign_key_unref);
 
+       rspamd_mempool_add_destructor (cfg->cfg_pool,
+                       (rspamd_mempool_destruct_t)rspamd_lru_hash_destroy,
+                       dkim_module_ctx->dkim_hash);
+       rspamd_mempool_add_destructor (cfg->cfg_pool,
+                       (rspamd_mempool_destruct_t)rspamd_lru_hash_destroy,
+                       dkim_module_ctx->dkim_sign_hash);
+
        if (dkim_module_ctx->trusted_only && !got_trusted) {
                msg_err_config (
                        "trusted_only option is set and no trusted domains are defined; disabling dkim module completely as it is useless in this case");