mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-25 20:38:08 +01:00
Prevent segmentation fault in notmuch_database_close
Previously opening a notmuch database in read write mode that has been locked resulted in the notmuch_database_open function executing notmuch_database_close as a cleanup function. notmuch_database_close failed to check whether the xapian database has in fact been created. Add a check whether the xapian database object has actually been created before trying to call its flush method. Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
This commit is contained in:
parent
0b2ff308ec
commit
e2e95caa51
1 changed files with 2 additions and 1 deletions
|
@ -716,7 +716,8 @@ void
|
||||||
notmuch_database_close (notmuch_database_t *notmuch)
|
notmuch_database_close (notmuch_database_t *notmuch)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
if (notmuch->mode == NOTMUCH_DATABASE_MODE_READ_WRITE)
|
if (notmuch->xapian_db != NULL &&
|
||||||
|
notmuch->mode == NOTMUCH_DATABASE_MODE_READ_WRITE)
|
||||||
(static_cast <Xapian::WritableDatabase *> (notmuch->xapian_db))->flush ();
|
(static_cast <Xapian::WritableDatabase *> (notmuch->xapian_db))->flush ();
|
||||||
} catch (const Xapian::Error &error) {
|
} catch (const Xapian::Error &error) {
|
||||||
if (! notmuch->exception_reported) {
|
if (! notmuch->exception_reported) {
|
||||||
|
|
Loading…
Reference in a new issue