aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers/local/camel-mh-folder.c
diff options
context:
space:
mode:
Diffstat (limited to 'camel/providers/local/camel-mh-folder.c')
-rw-r--r--camel/providers/local/camel-mh-folder.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/camel/providers/local/camel-mh-folder.c b/camel/providers/local/camel-mh-folder.c
index 64f9bbee81..c3b74dc3d6 100644
--- a/camel/providers/local/camel-mh-folder.c
+++ b/camel/providers/local/camel-mh-folder.c
@@ -149,14 +149,19 @@ static void mh_append_message(CamelFolder * folder, CamelMimeMessage * message,
return;
}
- if (camel_data_wrapper_write_to_stream((CamelDataWrapper *)message, output_stream) == -1) {
+ if (camel_data_wrapper_write_to_stream((CamelDataWrapper *)message, output_stream) == -1
+ || camel_stream_close(output_stream) == -1) {
camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
_("Cannot append message to mh folder: %s: %s"), name, g_strerror(errno));
camel_object_unref((CamelObject *)output_stream);
+ unlink(name);
g_free(name);
return;
}
+ /* close this? */
+ camel_object_unref((CamelObject *)output_stream);
+
g_free(name);
camel_object_trigger_event((CamelObject *)folder, "folder_changed", ((CamelLocalFolder *)mh_folder)->changes);