diff options
| author | David Bremner <david@tethera.net> | 2021-10-23 10:22:38 -0300 |
|---|---|---|
| committer | David Bremner <david@tethera.net> | 2021-10-30 13:51:50 -0300 |
| commit | fe51c275fcd7107d92b40de511086300ba4060ed (patch) | |
| tree | a8070ebfb3eea9e6779960750463c0bf7d6991fc /lib/open.cc | |
| parent | 8f0b84789d4fda0182e073b68b73160c9b94a4b7 (diff) | |
lib/load_config: deallocate / NULL database on fatal error
This fixes a potential memory leak, and makes the behaviour of
notmuch_database_load_config (somewhat) consistent with
n_d_{open,create} with config.
Diffstat (limited to 'lib/open.cc')
| -rw-r--r-- | lib/open.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/open.cc b/lib/open.cc index 6fa00a84..ba32c2f1 100644 --- a/lib/open.cc +++ b/lib/open.cc @@ -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; |
