From 99e51722286671c56cf4c25b67b6168ed5f7bfb5 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Wed, 18 Jan 2017 13:51:45 +0000 Subject: [PATCH] [Fix] Sigh, one more reload leak --- src/libserver/cfg_rcl.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/src/libserver/cfg_rcl.c b/src/libserver/cfg_rcl.c index c36ad9408..e80eae7dd 100644 --- a/src/libserver/cfg_rcl.c +++ b/src/libserver/cfg_rcl.c @@ -1063,8 +1063,17 @@ rspamd_rcl_add_module_path (struct rspamd_config *cfg, *ext_pos = '\0'; } - cfg->script_modules = g_list_prepend (cfg->script_modules, - cur_mod); + if (cfg->script_modules == NULL) { + cfg->script_modules = g_list_append (cfg->script_modules, + cur_mod); + rspamd_mempool_add_destructor (cfg->cfg_pool, + (rspamd_mempool_destruct_t)g_list_free, + cfg->script_modules); + } + else { + cfg->script_modules = g_list_append (cfg->script_modules, + cur_mod); + } } globfree (&globbuf); g_free (pattern); @@ -1094,7 +1103,17 @@ rspamd_rcl_add_module_path (struct rspamd_config *cfg, *ext_pos = '\0'; } - cfg->script_modules = g_list_prepend (cfg->script_modules, cur_mod); + if (cfg->script_modules == NULL) { + cfg->script_modules = g_list_append (cfg->script_modules, + cur_mod); + rspamd_mempool_add_destructor (cfg->cfg_pool, + (rspamd_mempool_destruct_t)g_list_free, + cfg->script_modules); + } + else { + cfg->script_modules = g_list_append (cfg->script_modules, + cur_mod); + } } return TRUE; -- 2.39.5