summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2009-06-05 15:52:24 +0400
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2009-06-05 15:52:24 +0400
commit2be622266017d22e7f65d47bc4023d0135d3e29b (patch)
tree46aeaa1e0026b48c2c03a2ec314dbd3872fde00c
parentb4d3f89aa0672bbdbb9631c0d336235b11afee2d (diff)
downloadrspamd-2be622266017d22e7f65d47bc4023d0135d3e29b.tar.gz
rspamd-2be622266017d22e7f65d47bc4023d0135d3e29b.zip
* Avoid double freeing of match info
-rw-r--r--src/plugins/surbl.c6
-rw-r--r--src/util.c2
2 files changed, 3 insertions, 5 deletions
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);
}
}
}