aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Bremner <david@tethera.net>2020-08-08 11:16:47 -0300
committerDavid Bremner <david@tethera.net>2020-12-23 19:48:43 -0400
commit27020503402af546d9d3017bb4a6346497c85d09 (patch)
tree51eb187ea5a63157f23fbd66c1dfb1529a9a56d1
parent17540b73e812d51777fd63709beb8e9be22e26b8 (diff)
lib/config: delay setting talloc destructor
If Xapian has thrown an exception, it is not safe to invoke the destructor when freeing the list struct. (cherry picked from commit 43ba5ed7eca6e9f6433b8c2c2a9d834d4101b92a)
-rw-r--r--lib/config.cc11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/config.cc b/lib/config.cc
index efab01e4..0b760dbc 100644
--- a/lib/config.cc
+++ b/lib/config.cc
@@ -133,8 +133,15 @@ notmuch_database_get_config_list (notmuch_database_t *notmuch,
*out = list;
DONE:
- if (status && list)
- talloc_free (list);
+ if (status) {
+ if (list) {
+ talloc_free (list);
+ if (status != NOTMUCH_STATUS_XAPIAN_EXCEPTION)
+ _notmuch_config_list_destroy (list);
+ }
+ } else {
+ talloc_set_destructor (list, _notmuch_config_list_destroy);
+ }
return status;
}