]> git.notmuchmail.org Git - notmuch/commitdiff
util: unreference objects referenced by the returned stream obj
authorDavid Bremner <david@tethera.net>
Sun, 22 Sep 2019 22:44:01 +0000 (19:44 -0300)
committerDavid Bremner <david@tethera.net>
Sat, 12 Oct 2019 11:45:55 +0000 (08:45 -0300)
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
util/gmime-extra.c

index f4e0c42a8e8ec9f273326eac630628ad9d44629d..fac41d399bb7309203770b8f30a6a3265f827412 100755 (executable)
@@ -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"
 # 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"
 ulimit -n 200
 gzip --recursive ${MAIL_DIR}
 test_expect_success "notmuch new"
index 7562d9062a20ab1b1a2a9c917c3d4e9b56afe7f5..4a591cae83af98b9c49bfaa4de19c68ee90c385c 100644 (file)
@@ -28,6 +28,8 @@ _gzfile_maybe_filter (GMimeStream *file_stream) {
 
        /* ignore filter id */
        (void)g_mime_stream_filter_add ((GMimeStreamFilter *)gzstream, gzfilter);
 
        /* 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;
        return gzstream;
     } else {
        return file_stream;