]> git.notmuchmail.org Git - notmuch/blobdiff - lib/database.cc
lib: Release resources if notmuch_database_open fails
[notmuch] / lib / database.cc
index a6d15a13208a5535cb11e3da8275f73cc20284a8..94022d7ce3ae9c060ecf18baaca1aa95afa11781 100644 (file)
@@ -703,6 +703,7 @@ notmuch_database_open (const char *path,
     } catch (const Xapian::Error &error) {
        fprintf (stderr, "A Xapian exception occurred opening database: %s\n",
                 error.get_msg().c_str());
     } catch (const Xapian::Error &error) {
        fprintf (stderr, "A Xapian exception occurred opening database: %s\n",
                 error.get_msg().c_str());
+       notmuch_database_close (notmuch);
        notmuch = NULL;
     }
 
        notmuch = NULL;
     }