]> git.notmuchmail.org Git - notmuch/commitdiff
lib/config: simplify cleanup in notmuch_database_get_config_list()
authorAnton Khirnov <anton@khirnov.net>
Sun, 27 Jul 2025 14:11:44 +0000 (16:11 +0200)
committerDavid Bremner <david@tethera.net>
Mon, 4 Aug 2025 13:15:38 +0000 (10:15 -0300)
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

index acb397ecc14efbd093f167df41747b69c2277cbb..6cc5986989969c3edc9de5d144ca37ef184c4c30 100644 (file)
@@ -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;