aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-09-30 15:20:23 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-09-30 15:23:49 +0100
commitf3cc2419301c00043bf8ade379792160d9a93a92 (patch)
tree2a4a36c4c16625118c39e9fb1f626d3f0f0a4c52
parent1b62013a8c6dc0603c38ff6f6820ae2c35bbf0f0 (diff)
downloadrspamd-f3cc2419301c00043bf8ade379792160d9a93a92.tar.gz
rspamd-f3cc2419301c00043bf8ade379792160d9a93a92.zip
[CritFix] Plug memory leak and potential memory corruption
-rw-r--r--src/libmime/message.c16
-rw-r--r--src/libserver/url.c7
2 files changed, 7 insertions, 16 deletions
diff --git a/src/libmime/message.c b/src/libmime/message.c
index cd29984f2..5028e7cc2 100644
--- a/src/libmime/message.c
+++ b/src/libmime/message.c
@@ -1003,13 +1003,6 @@ process_text_part (struct rspamd_task *task,
text_part->flags |= RSPAMD_MIME_TEXT_PART_FLAG_EMPTY;
}
- /* Handle offsets of this part */
- if (text_part->exceptions != NULL) {
- text_part->exceptions = g_list_reverse (text_part->exceptions);
- rspamd_mempool_add_destructor (task->task_pool,
- (rspamd_mempool_destruct_t) g_list_free, text_part->exceptions);
- }
-
rspamd_mempool_add_destructor (task->task_pool,
(rspamd_mempool_destruct_t) free_byte_array_callback,
text_part->content);
@@ -1070,8 +1063,13 @@ process_text_part (struct rspamd_task *task,
rspamd_url_text_extract (task->task_pool, task, text_part, FALSE);
}
- text_part->exceptions = g_list_sort (text_part->exceptions,
- exceptions_compare_func);
+ if (text_part->exceptions) {
+ text_part->exceptions = g_list_sort (text_part->exceptions,
+ exceptions_compare_func);
+ rspamd_mempool_add_destructor (task->task_pool,
+ (rspamd_mempool_destruct_t)g_list_free,
+ text_part->exceptions);
+ }
rspamd_extract_words (task, text_part);
}
diff --git a/src/libserver/url.c b/src/libserver/url.c
index 7231934fd..81908c41a 100644
--- a/src/libserver/url.c
+++ b/src/libserver/url.c
@@ -2387,13 +2387,6 @@ rspamd_url_text_extract (rspamd_mempool_t *pool,
rspamd_url_find_multiple (task->task_pool, part->stripped_content->data,
part->stripped_content->len, is_html, part->newlines,
rspamd_url_text_part_callback, &mcbd);
-
- /* Handle offsets of this part */
- if (part->exceptions != NULL) {
- part->exceptions = g_list_reverse (part->exceptions);
- rspamd_mempool_add_destructor (task->task_pool,
- (rspamd_mempool_destruct_t) g_list_free, part->exceptions);
- }
}
void