]> git.notmuchmail.org Git - notmuch/commitdiff
Fix error reporting in notmuch_database_find_message_by_filename
authorJustus Winter <4winter@informatik.uni-hamburg.de>
Sat, 17 Mar 2012 16:41:27 +0000 (17:41 +0100)
committerDavid Bremner <bremner@debian.org>
Sun, 18 Mar 2012 10:58:35 +0000 (07:58 -0300)
Formerly it was possible for *message_ret to be left
uninitialized. The documentation however clearly states that "[o]n any
failure or when the message is not found, this function initializes
'*message' to NULL".

Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
lib/database.cc

index 8f8df1a1434ed604ca2fe1a7bdf5f87b7084a28d..16c4354f2448bbc39bff3a1c3f630b4775575cd4 100644 (file)
@@ -1825,6 +1825,9 @@ notmuch_database_find_message_by_filename (notmuch_database_t *notmuch,
     if (message_ret == NULL)
        return NOTMUCH_STATUS_NULL_POINTER;
 
+    /* return NULL on any failure */
+    *message_ret = NULL;
+
     local = talloc_new (notmuch);
 
     try {