Plug a mem leak in the readwrite test

And use g_assert_[no_]error().

==2392== 49 (24 direct, 25 indirect) bytes in 1 blocks are definitely lost in loss record 451 of 573
==2392==    at 0x4005BDC: malloc (vg_replace_malloc.c:195)
==2392==    by 0x4057094: g_malloc (gmem.c:134)
==2392==    by 0x406F2D6: g_slice_alloc (gslice.c:836)
==2392==    by 0x406F31B: g_slice_alloc0 (gslice.c:848)
==2392==    by 0x403A8A6: g_error_new_literal (gerror.c:117)
==2392==    by 0x403AC31: g_set_error_literal (gerror.c:314)
==2392==    by 0x41B7619: g_output_stream_set_pending (goutputstream.c:1198)
==2392==    by 0x41B5799: g_output_stream_write (goutputstream.c:210)
==2392==    by 0x41B590B: g_output_stream_write_all (goutputstream.c:268)
==2392==    by 0x8049B54: verify_iostream (readwrite.c:110)

Bug #628331.
This commit is contained in:
Christian Persch 2010-09-03 15:35:44 -04:00 committed by Matthias Clasen
parent 93d85ade57
commit 35e101fa0a

View File

@ -110,12 +110,13 @@ verify_iostream (GFileIOStream *file_iostream)
res = g_output_stream_write_all (out, new_data, strlen (new_data),
&n_bytes, NULL, &error);
g_assert (!res);
g_assert (error != NULL);
g_assert (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CLOSED));
g_assert_error (error, G_IO_ERROR, G_IO_ERROR_CLOSED);
g_error_free (error);
error = NULL;
res = g_io_stream_close (iostream, NULL, &error);
g_assert (res && error == NULL);
g_assert (res);
g_assert_no_error (error);
g_free (modified_data);
}