diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2011-02-24 19:45:30 +0300 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2011-02-24 19:45:30 +0300 |
commit | 3f610ca7f6341261112fc372a8f53b5c40fb6be6 (patch) | |
tree | 9c231f781c7c4be94b05b30dad6076f4206310d0 /src | |
parent | 121efbcddf8ec41eea91aa80574dab3730bf8976 (diff) | |
download | rspamd-3f610ca7f6341261112fc372a8f53b5c40fb6be6.tar.gz rspamd-3f610ca7f6341261112fc372a8f53b5c40fb6be6.zip |
Fix several memory leaks in rspamd.
Diffstat (limited to 'src')
-rw-r--r-- | src/controller.c | 2 | ||||
-rw-r--r-- | src/dns.c | 3 | ||||
-rw-r--r-- | src/message.c | 2 | ||||
-rw-r--r-- | src/plugins/regexp.c | 2 | ||||
-rw-r--r-- | src/worker.c | 4 |
5 files changed, 10 insertions, 3 deletions
diff --git a/src/controller.c b/src/controller.c index 162217828..380c47791 100644 --- a/src/controller.c +++ b/src/controller.c @@ -1019,7 +1019,7 @@ controller_err_socket (GError * err, void *arg) if (err->code != EOF) { msg_info ("abnormally closing control connection, error: %s", err->message); } - + g_error_free (err); /* Free buffers */ destroy_session (session->s); } @@ -955,6 +955,9 @@ dns_parse_reply (guint8 *in, gint r, struct rspamd_dns_resolver *resolver, struc rep->elements = g_list_prepend (rep->elements, elt); } } + if (rep->elements) { + memory_pool_add_destructor (req->pool, (pool_destruct_func)g_list_free, rep->elements); + } return rep; } diff --git a/src/message.c b/src/message.c index a7b4d625e..0a88ab0f7 100644 --- a/src/message.c +++ b/src/message.c @@ -1015,8 +1015,8 @@ process_message (struct worker_task *task) if (task->raw_headers) { memory_pool_add_destructor (task->task_pool, (pool_destruct_func) g_free, task->raw_headers); - memory_pool_add_destructor (task->task_pool, (pool_destruct_func) g_list_free, task->raw_headers_list); process_raw_headers (task); + memory_pool_add_destructor (task->task_pool, (pool_destruct_func) g_list_free, task->raw_headers_list); } task->rcpts = g_mime_message_get_all_recipients (message); diff --git a/src/plugins/regexp.c b/src/plugins/regexp.c index d6e79f07d..8afefb9da 100644 --- a/src/plugins/regexp.c +++ b/src/plugins/regexp.c @@ -674,6 +674,7 @@ process_regexp (struct rspamd_regexp *re, struct worker_task *task, const gchar return 0; } else { + memory_pool_add_destructor (task->task_pool, (pool_destruct_func)g_list_free, headerlist); /* Check whether we have regexp for it */ if (re->regexp == NULL) { debug_task ("regexp contains only header and it is found %s", re->header); @@ -684,7 +685,6 @@ process_regexp (struct rspamd_regexp *re, struct worker_task *task, const gchar cur = headerlist; while (cur) { debug_task ("found header \"%s\" with value \"%s\"", re->header, (const gchar *)cur->data); - /* Try to match regexp */ if (cur->data && g_regex_match_full (re->regexp, cur->data, -1, 0, 0, NULL, &err) == TRUE) { if (G_UNLIKELY (re->is_test)) { diff --git a/src/worker.c b/src/worker.c index 0ac952b79..738002209 100644 --- a/src/worker.c +++ b/src/worker.c @@ -267,6 +267,9 @@ free_task (struct worker_task *task, gboolean is_soft) if (task->messages) { g_list_free (task->messages); } + if (task->received) { + g_list_free (task->received); + } memory_pool_delete (task->task_pool); if (task->dispatcher) { if (is_soft) { @@ -449,6 +452,7 @@ err_socket (GError * err, void *arg) if (ctx->is_custom) { fin_custom_filters (task); } + g_error_free (err); if (task->state != WRITE_REPLY) { destroy_session (task->s); } |