aboutsummaryrefslogtreecommitdiff
path: root/notmuch.c
diff options
context:
space:
mode:
authorCarl Worth <cworth@cworth.org>2009-10-27 16:12:04 -0700
committerCarl Worth <cworth@cworth.org>2009-10-27 16:12:08 -0700
commitb0190e59ac14851a0b79a00d58aad2e8febea92f (patch)
tree4c5f8f9eeeaa3fdb591ffc0db51106388b5d75b7 /notmuch.c
parent38bc6ba920cba54ab21c1fc0a6bb39f2690274ae (diff)
parent89697201080cd8aa3196792be1d0cae45c782952 (diff)
Merge branch to fix broken "notmuch setup" and "notmuch new"
I'm trying to stick to a habit of fixing previously-introduced bugs on side branches off of the commit that introduced the bug. The idea here is to make it easy to find the commits to cherry pick if bisecting in the future lands on one of the broken commits.
Diffstat (limited to 'notmuch.c')
-rw-r--r--notmuch.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/notmuch.c b/notmuch.c
index d716bce..a7559fc 100644
--- a/notmuch.c
+++ b/notmuch.c
@@ -180,7 +180,7 @@ add_files_recursive (notmuch_database_t *notmuch,
char *next = NULL;
time_t path_mtime, path_dbtime;
notmuch_status_t status, ret = NOTMUCH_STATUS_SUCCESS;
- notmuch_message_t *message, **closure;
+ notmuch_message_t *message = NULL, **closure;
/* If we're told to, we bail out on encountering a read-only
* directory, (with this being a clear clue from the user to
@@ -266,7 +266,6 @@ add_files_recursive (notmuch_database_t *notmuch,
state->added_messages++;
if (state->callback)
(state->callback) (message);
- notmuch_message_destroy (message);
break;
/* Non-fatal issues (go on to next file) */
case NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID:
@@ -292,6 +291,12 @@ add_files_recursive (notmuch_database_t *notmuch,
INTERNAL_ERROR ("add_message returned unexpected value: %d", status);
goto DONE;
}
+
+ if (message) {
+ notmuch_message_destroy (message);
+ message = NULL;
+ }
+
if (state->processed_files % 1000 == 0)
add_files_print_progress (state);
}