]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
* Try not to unref parser too early
authorVsevolod Stakhov <vsevolod@rambler-co.ru>
Mon, 2 Mar 2009 00:40:59 +0000 (03:40 +0300)
committerVsevolod Stakhov <vsevolod@rambler-co.ru>
Mon, 2 Mar 2009 00:40:59 +0000 (03:40 +0300)
src/message.c

index 9499a343be526d9ae2f160e17ee3a93f7abcc7c9..98c710fe8ff3ad08e353296c81405c0a100b60d6 100644 (file)
@@ -321,24 +321,22 @@ process_message (struct worker_task *task)
        /* create a new parser object to parse the stream */
        parser = g_mime_parser_new_with_stream (stream);
 
-       /* unref the stream (parser owns a ref, so this object does not actually get free'd until we destroy the parser) */
-       g_object_unref (stream);
-
        /* parse the message from the stream */
        message = g_mime_parser_construct_message (parser);
        
        task->message = message;
        memory_pool_add_destructor (task->task_pool, (pool_destruct_func)g_object_unref, task->message);
 
-       /* free the parser (and the stream) */
-       g_object_unref (parser);
-
        g_mime_message_foreach_part (message, mime_foreach_callback, task);
        
        msg_info ("process_message: found %d parts in message", task->parts_count);
 
        task->worker->srv->stat->messages_scanned ++;
 
+       /* free the parser (and the stream) */
+       g_object_unref (parser);
+       g_object_unref (stream);
+
        return 0;
 }