]> git.notmuchmail.org Git - notmuch/blobdiff - lib/database.cc
Tighten up a memory allocation.
[notmuch] / lib / database.cc
index 414460d276b31f7df23895d51749540fc4876c47..289e41c45bb4d8607fa0c1b31e31fa355bd21d40 100644 (file)
@@ -24,7 +24,6 @@
 
 #include <sys/time.h>
 #include <signal.h>
-#include <xapian.h>
 
 #include <glib.h> /* g_free, GPtrArray, GHashTable */
 
@@ -1671,7 +1670,8 @@ notmuch_database_add_message (notmuch_database_t *notmuch,
 
   DONE:
     if (message) {
-       if (ret == NOTMUCH_STATUS_SUCCESS && message_ret)
+       if ((ret == NOTMUCH_STATUS_SUCCESS ||
+            ret == NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID) && message_ret)
            *message_ret = message;
        else
            notmuch_message_destroy (message);
@@ -1710,7 +1710,7 @@ notmuch_database_remove_message (notmuch_database_t *notmuch,
        if (status)
            return status;
 
-       term = talloc_asprintf (notmuch, "%s%s", prefix, direntry);
+       term = talloc_asprintf (local, "%s%s", prefix, direntry);
 
        find_doc_ids_for_term (notmuch, term, &i, &end);