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 43ba5ed7ec)
This commit is contained in:
David Bremner 2020-08-08 11:16:47 -03:00
parent 17540b73e8
commit 2702050340

View file

@ -133,8 +133,15 @@ notmuch_database_get_config_list (notmuch_database_t *notmuch,
*out = list; *out = list;
DONE: DONE:
if (status && list) if (status) {
if (list) {
talloc_free (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; return status;
} }