X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=lib%2Fdatabase.cc;h=2fefcad7d163b5e9e40f9805a3d58b46a5704e37;hb=7864350c938944276c1a378539da7670c211b9b5;hp=16c4354f2448bbc39bff3a1c3f630b4775575cd4;hpb=9429141bb1b73a4e05b2f30d59c3c88bb87c2d43;p=notmuch diff --git a/lib/database.cc b/lib/database.cc index 16c4354f..2fefcad7 100644 --- a/lib/database.cc +++ b/lib/database.cc @@ -642,7 +642,7 @@ notmuch_database_open (const char *path, " read-write mode.\n", notmuch_path, version, NOTMUCH_DATABASE_VERSION); notmuch->mode = NOTMUCH_DATABASE_MODE_READ_ONLY; - notmuch_database_close (notmuch); + notmuch_database_destroy (notmuch); notmuch = NULL; goto DONE; } @@ -702,7 +702,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()); - notmuch_database_close (notmuch); + notmuch_database_destroy (notmuch); notmuch = NULL; } @@ -738,9 +738,19 @@ notmuch_database_close (notmuch_database_t *notmuch) } delete notmuch->term_gen; + notmuch->term_gen = NULL; delete notmuch->query_parser; + notmuch->query_parser = NULL; delete notmuch->xapian_db; + notmuch->xapian_db = NULL; delete notmuch->value_range_processor; + notmuch->value_range_processor = NULL; +} + +void +notmuch_database_destroy (notmuch_database_t *notmuch) +{ + notmuch_database_close (notmuch); talloc_free (notmuch); }