From: Vsevolod Stakhov Date: Tue, 19 Jun 2018 12:01:58 +0000 (+0100) Subject: [Fix] Fix destruction logic X-Git-Tag: 1.7.7~84 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=52a9a2eed69bed33764a2eb66715711ea660fbeb;p=rspamd.git [Fix] Fix destruction logic Issue: #2295 --- diff --git a/src/libserver/dynamic_cfg.c b/src/libserver/dynamic_cfg.c index ed9f24b15..39b2ebf7b 100644 --- a/src/libserver/dynamic_cfg.c +++ b/src/libserver/dynamic_cfg.c @@ -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);