aboutsummaryrefslogtreecommitdiffhomepage
path: root/notmuch-new.c
diff options
context:
space:
mode:
authorGravatar Austin Clements <amdragon@MIT.EDU>2012-04-22 11:50:52 -0400
committerGravatar David Bremner <bremner@debian.org>2012-04-24 23:25:52 -0300
commit2e7b6494046342872f1f79418679b1554d6d1005 (patch)
tree8f6e5a73f33c82bc4ba859572aa884828440c9cb /notmuch-new.c
parent746fef0aeafe1f29720140ab8778cdee22d519cb (diff)
new: Fix missing end_atomic in remove_filename on error
Previously, if we failed to find the message by filename in remove_filename, we would return immediately from the function without ending its atomic block. Now this code follows the usual goto DONE idiom to perform cleanup.
Diffstat (limited to 'notmuch-new.c')
-rw-r--r--notmuch-new.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/notmuch-new.c b/notmuch-new.c
index bf9b1209..473201e9 100644
--- a/notmuch-new.c
+++ b/notmuch-new.c
@@ -779,7 +779,8 @@ remove_filename (notmuch_database_t *notmuch,
return status;
status = notmuch_database_find_message_by_filename (notmuch, path, &message);
if (status || message == NULL)
- return status;
+ goto DONE;
+
status = notmuch_database_remove_message (notmuch, path);
if (status == NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID) {
add_files_state->renamed_messages++;
@@ -790,6 +791,8 @@ remove_filename (notmuch_database_t *notmuch,
add_files_state->removed_messages++;
}
notmuch_message_destroy (message);
+
+ DONE:
notmuch_database_end_atomic (notmuch);
return status;
}