]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Sigh, one more reload leak
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 18 Jan 2017 13:51:45 +0000 (13:51 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 18 Jan 2017 13:51:45 +0000 (13:51 +0000)
src/libserver/cfg_rcl.c

index c36ad9408c424b8db368b4d9606c0db358e9f364..e80eae7dd0b82c3644148c0c20e8f19b044bdba2 100644 (file)
@@ -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;