diff --git a/mail/e-mail-folder-utils.c b/mail/e-mail-folder-utils.c
index fe093ad..1c2288b 100644
--- a/mail/e-mail-folder-utils.c
+++ b/mail/e-mail-folder-utils.c
@@ -1165,7 +1165,7 @@ e_mail_folder_save_messages_sync (CamelFolder *folder,
 {
 	GFileOutputStream *file_output_stream;
 	GByteArray *byte_array;
-	CamelStream *base_stream;
+	CamelStream *base_stream = NULL;
 	gboolean success = TRUE;
 	guint ii;
 
@@ -1194,10 +1194,6 @@ e_mail_folder_save_messages_sync (CamelFolder *folder,
 		return FALSE;
 	}
 
-	/* CamelStreamMem takes ownership of the GByteArray. */
-	byte_array = g_byte_array_new ();
-	base_stream = camel_stream_mem_new_with_byte_array (byte_array);
-
 	for (ii = 0; ii < message_uids->len; ii++) {
 		CamelMimeMessage *message;
 		CamelMimeFilter *filter;
@@ -1207,6 +1203,12 @@ e_mail_folder_save_messages_sync (CamelFolder *folder,
 		gint percent;
 		gint retval;
 
+		/* CamelStreamMem takes ownership of the GByteArray. */
+		if (base_stream)
+			g_object_unref(base_stream);
+		byte_array = g_byte_array_new ();
+		base_stream = camel_stream_mem_new_with_byte_array (byte_array);
+
 		uid = g_ptr_array_index (message_uids, ii);
 
 		message = camel_folder_get_message_sync (
@@ -1264,12 +1266,6 @@ e_mail_folder_save_messages_sync (CamelFolder *folder,
 		percent = ((ii + 1) * 100) / message_uids->len;
 		camel_operation_progress (cancellable, percent);
 
-		/* Flush the buffer for the next message.
-		 * For memory streams this never fails. */
-		g_seekable_seek (
-			G_SEEKABLE (base_stream),
-			0, G_SEEK_SET, NULL, NULL);
-
 		g_object_unref (message);
 	}
 
