From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id iNLFB2Lz2mERcwEAgWs5BA (envelope-from ) for ; Sun, 09 Jan 2022 15:38:26 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id +P4YBGLz2mEw+QAAauVa8A (envelope-from ) for ; Sun, 09 Jan 2022 15:38:26 +0100 Received: from mail.notmuchmail.org (yantan.tethera.net [IPv6:2a01:4f9:c011:7a79::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id DBAE529A5F for ; Sun, 9 Jan 2022 15:38:25 +0100 (CET) Received: from yantan.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 7EB4D5F6D3; Sun, 9 Jan 2022 14:38:15 +0000 (UTC) Received: from fethera.tethera.net (fethera.tethera.net [IPv6:2607:5300:60:c5::1]) by mail.notmuchmail.org (Postfix) with ESMTP id 03ADB5F402 for ; Sun, 9 Jan 2022 14:38:13 +0000 (UTC) Received: by fethera.tethera.net (Postfix, from userid 1001) id 786645FC48; Sun, 9 Jan 2022 09:38:12 -0500 (EST) Received: (nullmailer pid 3682816 invoked by uid 1000); Sun, 09 Jan 2022 14:38:10 -0000 From: David Bremner To: notmuch@notmuchmail.org Subject: [PATCH v2 4/4] lib/database: delete stemmer on destroy Date: Sun, 9 Jan 2022 10:38:05 -0400 Message-Id: <20220109143805.3682660-5-david@tethera.net> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220109143805.3682660-1-david@tethera.net> References: <20220109143805.3682660-1-david@tethera.net> MIME-Version: 1.0 Message-ID-Hash: JN5VJAJSGCWWTTBSYWLLUYPVV44SPIF2 X-Message-ID-Hash: JN5VJAJSGCWWTTBSYWLLUYPVV44SPIF2 X-MailFrom: bremner@tethera.net X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.3 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_IN X-Migadu-Country: DE ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1641739105; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-owner:list-unsubscribe:list-subscribe:list-post; bh=V+HumpjYEoWOpiwDBx688oJ0Rt8iCzGSJHhq9wTfdB8=; b=FOC4kMcXZjTnKeyUiVHgE1Pt9nRPVqKZaUUpVwAL7ohX6QHwYX71giiqg3O2jc4rUAj45B qRyCnpqmaCMWHkajGEhWj690oRM02HHNCLbVwap6KCgYeaUM3xdZK3TCkAyjTPeKXXEKCS nRFb/BIS8DcC+vnPaHcFtUfaUvwXnr81TvTnvvwkNkXIIcalTIPPzuyl5vI7ISiDMZZzMT IuefykFc19WGPsbqbCrgsp5MpBg8izBO6h/GHMO3NjEPsqkThSZeQy+bwfWmt9rHPxXirz r5hPDPwriQ5+C4VDAdCg6Vpfoup5RwhLHvekk+4AJaB94AeRrxH54GBw40ypOQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1641739105; a=rsa-sha256; cv=none; b=CILnsOAuWGQC7YEEDpOv5bQ0qIGaNTJveSeKVkOWQSGkD1zMaUQM+hBg7rGFdqBpNzgmNI fhuH3WhDx8OHTX8N8wEAgRD9C5PS4p/pmx1TPk36ruNHgx1IwXIsLSZSwkL6xlRjh/A8Gm EOopmZMo/oHDWNJZkSNCD56UotAb1bRtE+9lX94DS/q5gcvyGlPqPUgf4A1XC36WIz12zE zK+6mtroMbuMRf15zQh9owG1aFaNLtyd6CueOhbCyf7uS2tgIiYBZPQ6wcZpXvxUeizYy1 MSHZL9kLbux9SyTQsNulbLGWB3hNErX9DAmbxTCLSLKUcF7J/iXgKqJ4Oat8eQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2a01:4f9:c011:7a79::1 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Spam-Score: -2.29 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2a01:4f9:c011:7a79::1 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: DBAE529A5F X-Spam-Score: -2.29 X-Migadu-Scanner: scn0.migadu.com X-TUID: /dy/v8ygYbTE 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} < #include -- 2.34.1