[PATCH v2 1/7] lib/config: simplify cleanup in notmuch_database_get_config_list()

Subject: [PATCH v2 1/7] lib/config: simplify cleanup in notmuch_database_get_config_list()

Date: Sun, 27 Jul 2025 16:11:44 +0200

To: notmuch@notmuchmail.org

Cc:

From: Anton Khirnov


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.39.5

_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: