lib/database: delete stemmer on destroy
authorDavid Bremner <david@tethera.net>
Sun, 9 Jan 2022 14:38:05 +0000 (10:38 -0400)
committerDavid Bremner <david@tethera.net>
Sun, 23 Jan 2022 01:14:29 +0000 (21:14 -0400)
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
test/T800-asan.sh

index 0effe97844dba59364ef0fc1d5df74feaa4a135f..df83e2048673b235e6c1055ccb47d39923f480a7 100644 (file)
@@ -755,6 +755,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);
 
index 8c29457822fd696278260e0aee8b98ab17c9621c..8607732e176b9978bd72622a6e5ddf8a255e6710 100755 (executable)
@@ -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>