Unbreak the "notmuch setup" command.
authorCarl Worth <cworth@cworth.org>
Tue, 27 Oct 2009 19:00:58 +0000 (12:00 -0700)
committerCarl Worth <cworth@cworth.org>
Tue, 27 Oct 2009 19:00:58 +0000 (12:00 -0700)
The recent addition of support for automatically adding tags to
new messages for "notmuch new" caused "notmuch setup" to segfault.
The fix is simple, (just need to move a destroy function to inside
a nearby if block).

Did I mention recently we need to add a test suite?

notmuch.c

index f620f58dfe8aadcbcbfe0bd2186996c9fbf626c6..ca30b521d725fe97ea9b77dbc040b74a3ce9ab10 100644 (file)
--- a/notmuch.c
+++ b/notmuch.c
@@ -264,9 +264,10 @@ add_files_recursive (notmuch_database_t *notmuch,
                    /* success */
                    case NOTMUCH_STATUS_SUCCESS:
                        state->added_messages++;
-                       if (state->callback)
+                       if (state->callback) {
                            (state->callback) (message);
-                       notmuch_message_destroy (message);
+                           notmuch_message_destroy (message);
+                       }
                        break;
                    /* Non-fatal issues (go on to next file) */
                    case NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID: