]> git.notmuchmail.org Git - notmuch/commitdiff
indexopts: avoid a memleak in the error path master
authorAnton Khirnov <anton@khirnov.net>
Sat, 7 Feb 2026 17:47:16 +0000 (18:47 +0100)
committerDavid Bremner <david@tethera.net>
Sun, 8 Feb 2026 00:19:36 +0000 (09:19 +0900)
lib/indexopts.c

index 2ffd19424ea9752d2976a2438c6214c63dba5e41..da3787003fc56e0652a32e8ab74d55242a63762e 100644 (file)
@@ -37,7 +37,7 @@ notmuch_database_get_default_indexopts (notmuch_database_t *db)
     notmuch_status_t err = notmuch_database_get_config (db, "index.decrypt", &decrypt_policy);
 
     if (err)
-       return NULL;
+       goto FAIL;
 
     if (decrypt_policy) {
        if ((! (strcasecmp (decrypt_policy, "true"))) ||
@@ -54,6 +54,10 @@ notmuch_database_get_default_indexopts (notmuch_database_t *db)
 
     free (decrypt_policy);
     return ret;
+
+FAIL:
+    talloc_free (ret);
+    return NULL;
 }
 
 notmuch_status_t