]> source.dussan.org Git - rspamd.git/commitdiff
[CritFix] Plug memory leak and potential memory corruption
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 30 Sep 2016 14:20:23 +0000 (15:20 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 30 Sep 2016 14:23:49 +0000 (15:23 +0100)
src/libmime/message.c
src/libserver/url.c

index cd29984f2272301f962321de6223da5707df51b3..5028e7cc26b144f76ab8fb8f05383e66d75a1cf7 100644 (file)
@@ -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);
 }
index 7231934fd2ce3325ee47a6e24326645c4bf68d27..81908c41a4b5bcc23c5204a034b858322462c6f8 100644 (file)
@@ -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