]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: test-istream-concat - Unref child istreams immediately
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Mon, 4 Oct 2021 22:39:50 +0000 (01:39 +0300)
committertimo.sirainen <timo.sirainen@open-xchange.com>
Fri, 8 Oct 2021 13:14:15 +0000 (13:14 +0000)
This doesn't currently make a difference, since istream-concat keeps them
internally referenced. In case this changes and snapshot handling isn't
fixed similarly to istream-chain, the unit test should now fail.

src/lib/test-istream-concat.c

index 297536439545af8982232e205c2beb85f92449c9..5e80cfa7b622b4666ce722270368bc7846d62780 100644 (file)
@@ -178,6 +178,11 @@ static void test_istream_concat_snapshot(void)
        };
 
        input = i_stream_create_concat(test_istreams);
+       for (unsigned int i = 0; test_istreams[i] != NULL; i++) {
+               struct istream *tmp_istream = test_istreams[i];
+               i_stream_unref(&tmp_istream);
+       }
+
        test_istream_set_size(test_istreams[0], 20);
        test_istream_set_size(test_istreams[1], 0);
        test_istream_set_size(test_istreams[2], 0);
@@ -223,8 +228,6 @@ static void test_istream_concat_snapshot(void)
                "!\"#$%&'()*+,-./01234567890:;<=", 51) == 0);
 
        i_stream_unref(&input);
-       for (unsigned int i = 0; test_istreams[i] != NULL; i++)
-               i_stream_unref(&test_istreams[i]);
        test_end();
 }