[PATCH v2 4/4] lib/database: delete stemmer on destroy

Subject: [PATCH v2 4/4] lib/database: delete stemmer on destroy

Date: Sun, 9 Jan 2022 10:38:05 -0400

To: notmuch@notmuchmail.org

Cc:

From: David Bremner


Commit [0] left the stemmer object accessible, but did not add
de-allocation code to notmuch_database_destroy. This commit corrects
that oversight.

Leak originally reported by Austin Ray [1].

[0]: 3202e0d1feba1ab955ba1c07098c00208f8f0ada
[1]: id:20220105224538.m36lnjn7rf3ieonc@athena
---
 lib/database.cc   | 2 ++
 test/T800-asan.sh | 1 -
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/database.cc b/lib/database.cc
index 6ef56d56..a012ebcf 100644
--- a/lib/database.cc
+++ b/lib/database.cc
@@ -753,6 +753,8 @@ notmuch_database_destroy (notmuch_database_t *notmuch)
     notmuch->date_range_processor = NULL;
     delete notmuch->last_mod_range_processor;
     notmuch->last_mod_range_processor = NULL;
+    delete notmuch->stemmer;
+    notmuch->stemmer = NULL;
 
     talloc_free (notmuch);
 
diff --git a/test/T800-asan.sh b/test/T800-asan.sh
index 8c294578..8607732e 100755
--- a/test/T800-asan.sh
+++ b/test/T800-asan.sh
@@ -12,7 +12,6 @@ add_email_corpus
 TEST_CFLAGS="-fsanitize=address"
 
 test_begin_subtest "open and destroy"
-test_subtest_known_broken
 test_C ${MAIL_DIR} ${NOTMUCH_CONFIG} <<EOF
 #include <notmuch.h>
 #include <stdio.h>
-- 
2.34.1

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

Thread: