From 8c1ba9d336729d2e18fde48fab8bd8fbce4e73af Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Fri, 14 Nov 2014 15:32:29 +0000 Subject: [PATCH] Fix memory corruption on fuzzy reload. Reported by: @citrin --- src/plugins/fuzzy_check.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/plugins/fuzzy_check.c b/src/plugins/fuzzy_check.c index a2dd959bc..d89798c87 100644 --- a/src/plugins/fuzzy_check.c +++ b/src/plugins/fuzzy_check.c @@ -219,11 +219,6 @@ parse_mime_types (const gchar *str) } } - if (res != NULL) { - rspamd_mempool_add_destructor (fuzzy_module_ctx->fuzzy_pool, - (rspamd_mempool_destruct_t)g_list_free, res); - } - return res; } @@ -320,13 +315,17 @@ fuzzy_parse_rule (struct rspamd_config *cfg, const ucl_object_t *obj) if (value->type == UCL_ARRAY) { value = value->value.av; } - LL_FOREACH (value, cur) - { + LL_FOREACH (value, cur) { rule->mime_types = g_list_concat (rule->mime_types, parse_mime_types (ucl_obj_tostring (cur))); } } + if (rule->mime_types != NULL) { + rspamd_mempool_add_destructor (fuzzy_module_ctx->fuzzy_pool, + (rspamd_mempool_destruct_t)g_list_free, rule->mime_types); + } + if ((value = ucl_object_find_key (obj, "max_score")) != NULL) { rule->max_score = ucl_obj_todouble (value); } -- 2.39.5