]> git.notmuchmail.org Git - notmuch/blobdiff - lib/open.cc
lib/load_config: deallocate / NULL database on fatal error
[notmuch] / lib / open.cc
index 6fa00a843b9201d5bdf56dd15b3139e7e5adb8ec..ba32c2f16d84d9d19c5bdcf1e5ad58db76d411d7 100644 (file)
@@ -871,6 +871,13 @@ notmuch_database_load_config (const char *database_path,
     if (status_string)
        *status_string = message;
 
+    if (status &&
+       status != NOTMUCH_STATUS_NO_DATABASE
+       && status != NOTMUCH_STATUS_NO_CONFIG) {
+       notmuch_database_destroy (notmuch);
+       notmuch = NULL;
+    }
+
     if (database)
        *database = notmuch;