From 2e87a00f3909e7f5ddd3b51230d8b9483efbf380 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sun, 27 Jul 2025 16:11:44 +0200 Subject: [PATCH] lib/config: simplify cleanup in notmuch_database_get_config_list() The list destructor is always set when necessary (i.e. if the iterator is successfully created), so there is never a need to invoke it explicitly, even on failure. --- lib/config.cc | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/lib/config.cc b/lib/config.cc index acb397ec..6cc59869 100644 --- a/lib/config.cc +++ b/lib/config.cc @@ -170,14 +170,8 @@ notmuch_database_get_config_list (notmuch_database_t *notmuch, *out = list; DONE: - 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); + if (status && list) { + talloc_free (list); } return status; -- 2.45.2