From: Vsevolod Stakhov Date: Fri, 5 Jun 2009 11:52:24 +0000 (+0400) Subject: * Avoid double freeing of match info X-Git-Tag: 0.2.7~128 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=2be622266017d22e7f65d47bc4023d0135d3e29b;p=rspamd.git * Avoid double freeing of match info --- diff --git a/src/plugins/surbl.c b/src/plugins/surbl.c index 0fb259b55..4ac156f99 100644 --- a/src/plugins/surbl.c +++ b/src/plugins/surbl.c @@ -52,7 +52,7 @@ surbl_module_init (struct config_file *cfg, struct module_ctx **ctx) surbl_module_ctx->use_redirector = 0; surbl_module_ctx->suffixes = NULL; surbl_module_ctx->bits = NULL; - surbl_module_ctx->surbl_pool = memory_pool_new (1024); + surbl_module_ctx->surbl_pool = memory_pool_new (memory_pool_get_size ()); surbl_module_ctx->tld2_file = NULL; surbl_module_ctx->whitelist_file = NULL; @@ -63,6 +63,7 @@ surbl_module_init (struct config_file *cfg, struct module_ctx **ctx) surbl_module_ctx->whitelist = g_hash_table_new (g_str_hash, g_str_equal); /* Register destructors */ memory_pool_add_destructor (surbl_module_ctx->surbl_pool, (pool_destruct_func)g_hash_table_remove_all, surbl_module_ctx->whitelist); + memory_pool_add_destructor (surbl_module_ctx->surbl_pool, (pool_destruct_func)g_list_free, surbl_module_ctx->suffixes); memory_pool_add_destructor (surbl_module_ctx->surbl_pool, (pool_destruct_func)g_list_free, surbl_module_ctx->bits); @@ -249,7 +250,6 @@ format_surbl_request (memory_pool_t *pool, f_str_t *hostname, struct suffix_item /* Match additional part for hosters */ g_free (part1); g_free (part2); - g_match_info_free (info); if (g_regex_match_full (surbl_module_ctx->extract_hoster_regexp, hostname->begin, hostname->len, 0, 0, &info, NULL) == TRUE) { gchar *hpart1, *hpart2, *hpart3; hpart1 = g_match_info_fetch (info, 1); @@ -657,14 +657,12 @@ surbl_test_url (struct worker_task *task) struct redirector_param param; /* Try to check lists */ -#if 0 if (surbl_module_ctx->tld2_file) { maybe_parse_host_list (surbl_module_ctx->surbl_pool, surbl_module_ctx->tld2, surbl_module_ctx->tld2_file, task->ts.tv_sec); } if (surbl_module_ctx->whitelist_file) { maybe_parse_host_list (surbl_module_ctx->surbl_pool, surbl_module_ctx->whitelist, surbl_module_ctx->whitelist_file, task->ts.tv_sec); } -#endif url_tree = g_tree_new ((GCompareFunc)g_ascii_strcasecmp); diff --git a/src/util.c b/src/util.c index 3b151ed63..026cfbd23 100644 --- a/src/util.c +++ b/src/util.c @@ -952,7 +952,7 @@ maybe_parse_host_list (memory_pool_t *pool, GHashTable *tbl, const char *filenam if (cur_st.st_mtime > lf->st.st_mtime) { g_hash_table_remove (listfiles, lf->filename); g_hash_table_remove_all (tbl); - parse_host_list (pool, tbl, filename); + return parse_host_list (pool, tbl, filename); } } }