]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Fix destruction logic
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 19 Jun 2018 12:01:58 +0000 (13:01 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 19 Jun 2018 12:01:58 +0000 (13:01 +0100)
Issue: #2295

src/libserver/dynamic_cfg.c

index ed9f24b157532c76b9a44f2ba479b458e4b3b9dd..39b2ebf7b676099d809f8178f83310ffa5edb2ee 100644 (file)
@@ -234,6 +234,10 @@ json_config_dtor_cb (struct map_cb_data *data)
                        g_string_free (jb->buf, TRUE);
                }
 
+               if (jb->cfg && jb->cfg->current_dynamic_conf) {
+                       ucl_object_unref (jb->cfg->current_dynamic_conf);
+               }
+
                g_free (jb);
        }
 }
@@ -259,9 +263,6 @@ init_dynamic_config (struct rspamd_config *cfg)
        jb->cfg = cfg;
        *pjb = jb;
        cfg->current_dynamic_conf = ucl_object_typed_new (UCL_ARRAY);
-       rspamd_mempool_add_destructor (cfg->cfg_pool,
-                       (rspamd_mempool_destruct_t)ucl_object_unref,
-                       cfg->current_dynamic_conf);
        rspamd_mempool_add_destructor (cfg->cfg_pool,
                        (rspamd_mempool_destruct_t)g_free,
                        pjb);