lib/database: delete stemmer on destroy

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]: 3202e0d1fe
[1]: id:20220105224538.m36lnjn7rf3ieonc@athena
This commit is contained in:
David Bremner 2022-01-09 10:38:05 -04:00
parent df7c5acd75
commit 2786aa4d54
2 changed files with 2 additions and 1 deletions

View file

@ -755,6 +755,8 @@ notmuch_database_destroy (notmuch_database_t *notmuch)
notmuch->date_range_processor = NULL; notmuch->date_range_processor = NULL;
delete notmuch->last_mod_range_processor; delete notmuch->last_mod_range_processor;
notmuch->last_mod_range_processor = NULL; notmuch->last_mod_range_processor = NULL;
delete notmuch->stemmer;
notmuch->stemmer = NULL;
talloc_free (notmuch); talloc_free (notmuch);

View file

@ -12,7 +12,6 @@ add_email_corpus
TEST_CFLAGS="-fsanitize=address" TEST_CFLAGS="-fsanitize=address"
test_begin_subtest "open and destroy" test_begin_subtest "open and destroy"
test_subtest_known_broken
test_C ${MAIL_DIR} ${NOTMUCH_CONFIG} <<EOF test_C ${MAIL_DIR} ${NOTMUCH_CONFIG} <<EOF
#include <notmuch.h> #include <notmuch.h>
#include <stdio.h> #include <stdio.h>