From 4c5b17b10b786994255641fee8df4733c3586f3e Mon Sep 17 00:00:00 2001 From: David Bremner Date: Sun, 22 Sep 2019 19:44:01 -0300 Subject: [PATCH] util: unreference objects referenced by the returned stream obj 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.43.0