X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=database.cc;h=0fd0bdadf8103366b4c2f95924926d1f532df0ca;hp=9831d79cdf912f50da160289268c1db504d6d836;hb=326f73374e945d94c9a395e17bbc8229e91a12c1;hpb=31db02a8c1afdb025da6e0e7e62630ffffc69eb7 diff --git a/database.cc b/database.cc index 9831d79c..0fd0bdad 100644 --- a/database.cc +++ b/database.cc @@ -505,6 +505,8 @@ notmuch_database_open (const char *path) void notmuch_database_close (notmuch_database_t *notmuch) { + notmuch->xapian_db->flush (); + delete notmuch->query_parser; delete notmuch->xapian_db; talloc_free (notmuch); @@ -834,6 +836,9 @@ notmuch_database_add_message (notmuch_database_t *notmuch, const char *from, *to, *subject, *old_filename; char *message_id; + if (message_ret) + *message_ret = NULL; + message_file = notmuch_message_file_open (filename); if (message_file == NULL) { ret = NOTMUCH_STATUS_FILE_ERROR; @@ -930,7 +935,7 @@ notmuch_database_add_message (notmuch_database_t *notmuch, DONE: if (message) { - if (message_ret) + if (ret == NOTMUCH_STATUS_SUCCESS && message_ret) *message_ret = message; else notmuch_message_destroy (message);