From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id E0D506DE028C for ; Sun, 22 Sep 2019 15:51:38 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.057 X-Spam-Level: X-Spam-Status: No, score=-0.057 tagged_above=-999 required=5 tests=[AWL=-0.056, SPF_PASS=-0.001] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Hld996kJ4HFY for ; Sun, 22 Sep 2019 15:51:38 -0700 (PDT) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by arlo.cworth.org (Postfix) with ESMTPS id 0D8546DE0232 for ; Sun, 22 Sep 2019 15:51:38 -0700 (PDT) Received: from remotemail by fethera.tethera.net with local (Exim 4.89) (envelope-from ) id 1iCAhd-00029i-8Y; Sun, 22 Sep 2019 18:51:37 -0400 Received: (nullmailer pid 5848 invoked by uid 1000); Sun, 22 Sep 2019 22:44:10 -0000 From: David Bremner To: James Troup , notmuch@notmuchmail.org Subject: [PATCH 2/2] util: unreference objects referenced by the returned stream obj Date: Sun, 22 Sep 2019 19:44:01 -0300 Message-Id: <20190922224401.5716-3-david@tethera.net> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190922224401.5716-1-david@tethera.net> References: <87pnjsf9q5.fsf@canonical.com> <20190922224401.5716-1-david@tethera.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Sep 2019 22:51:39 -0000 We want freeing the returned stream to also free these underlying objects. Compare tests/test-filters.c in the gmime 3.2.x source, which uses this same idiom. Thanks to James Troup for the report and the fix. --- test/T750-gzip.sh | 1 - util/gmime-extra.c | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/test/T750-gzip.sh b/test/T750-gzip.sh index f4e0c42a..fac41d39 100755 --- a/test/T750-gzip.sh +++ b/test/T750-gzip.sh @@ -170,7 +170,6 @@ test_expect_equal_file EXPECTED OUTPUT # there are more than 200 messages in this corpus add_email_corpus lkml test_begin_subtest "new doesn't run out of file descriptors with many gzipped files" -test_subtest_known_broken ulimit -n 200 gzip --recursive ${MAIL_DIR} test_expect_success "notmuch new" diff --git a/util/gmime-extra.c b/util/gmime-extra.c index 7562d906..4a591cae 100644 --- a/util/gmime-extra.c +++ b/util/gmime-extra.c @@ -28,6 +28,8 @@ _gzfile_maybe_filter (GMimeStream *file_stream) { /* ignore filter id */ (void)g_mime_stream_filter_add ((GMimeStreamFilter *)gzstream, gzfilter); + g_object_unref(gzfilter); + g_object_unref(file_stream); return gzstream; } else { return file_stream; -- 2.23.0