[PATCH] indexopts: avoid a memleak in the error path

Subject: [PATCH] indexopts: avoid a memleak in the error path

Date: Sat, 7 Feb 2026 18:47:16 +0100

To: notmuch@notmuchmail.org

Cc:

From: Anton Khirnov


---
previously a part of the 'indexing attachment contents' patchset
---
 lib/indexopts.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/indexopts.c b/lib/indexopts.c
index 2ffd1942..da378700 100644
--- a/lib/indexopts.c
+++ b/lib/indexopts.c
@@ -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
-- 
2.47.3

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

Thread: