From: David Bremner <david@tethera.net>
To: James Troup <james.troup@canonical.com>, 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 [thread overview]
Message-ID: <20190922224401.5716-3-david@tethera.net> (raw)
In-Reply-To: <20190922224401.5716-1-david@tethera.net>
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 -
| 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"
--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
next prev parent reply other threads:[~2019-09-22 22:51 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-22 18:48 [PATCH] fix file descriptor leak with compressed email James Troup
2019-09-22 22:43 ` fix file descriptor leak David Bremner
2019-09-22 22:44 ` [PATCH 1/2] test: known broken test file descriptor leak in gzip file open David Bremner
2019-09-22 22:44 ` David Bremner [this message]
2019-10-13 12:31 ` fix file descriptor leak David Bremner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190922224401.5716-3-david@tethera.net \
--to=david@tethera.net \
--cc=james.troup@canonical.com \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).