diff options
-rw-r--r-- | src/message.c | 21 | ||||
-rw-r--r-- | src/worker.c | 2 |
2 files changed, 16 insertions, 7 deletions
diff --git a/src/message.c b/src/message.c index c2651bdc8..7d30f53f9 100644 --- a/src/message.c +++ b/src/message.c @@ -329,8 +329,12 @@ process_message (struct worker_task *task) GMimeMessage *message; GMimeParser *parser; GMimeStream *stream; - - stream = g_mime_stream_mem_new_with_buffer (task->msg->begin, task->msg->len); + GByteArray *tmp; + + tmp = memory_pool_alloc (task->task_pool, sizeof (GByteArray)); + tmp->data = task->msg->begin; + tmp->len = task->msg->len; + stream = g_mime_stream_mem_new_with_byte_array (tmp); msg_debug ("process_message: construct mime parser from string length %ld", (long int)task->msg->len); /* create a new parser object to parse the stream */ parser = g_mime_parser_new_with_stream (stream); @@ -433,8 +437,13 @@ process_learn (struct controller_session *session) GMimeMessage *message; GMimeParser *parser; GMimeStream *stream; + GByteArray *tmp; + + tmp = memory_pool_alloc (session->session_pool, sizeof (GByteArray)); + tmp->data = session->learn_buf->begin; + tmp->len = session->learn_buf->len; + stream = g_mime_stream_mem_new_with_byte_array (tmp); - stream = g_mime_stream_mem_new_with_buffer (session->learn_buf->begin, session->learn_buf->len); /* create a new parser object to parse the stream */ parser = g_mime_parser_new_with_stream (stream); @@ -446,14 +455,14 @@ process_learn (struct controller_session *session) memory_pool_add_destructor (session->session_pool, (pool_destruct_func)g_object_unref, message); - /* free the parser (and the stream) */ - g_object_unref (parser); - #ifdef GMIME24 g_mime_message_foreach (message, mime_learn_foreach_callback, session); #else g_mime_message_foreach_part (message, mime_learn_foreach_callback, session); #endif + + /* free the parser (and the stream) */ + g_object_unref (parser); return 0; } diff --git a/src/worker.c b/src/worker.c index 8e1225024..53a4db087 100644 --- a/src/worker.c +++ b/src/worker.c @@ -107,7 +107,7 @@ free_task (struct worker_task *task, gboolean is_soft) while ((part = g_list_first (task->parts))) { task->parts = g_list_remove_link (task->parts, part); p = (struct mime_part *)part->data; - g_byte_array_free (p->content, FALSE); + g_byte_array_free (p->content, TRUE); g_list_free_1 (part); } memory_pool_delete (task->task_pool); |