Plug a mem leak in readwrite test
authorChristian Persch <chpe@gnome.org>
Fri, 3 Sep 2010 19:44:28 +0000 (15:44 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Fri, 3 Sep 2010 19:44:28 +0000 (15:44 -0400)
==10395== 80 (24 direct, 56 indirect) bytes in 1 blocks are definitely lost in loss record 529 of 561
==10395==    at 0x4005BDC: malloc (vg_replace_malloc.c:195)
==10395==    by 0x4057094: g_malloc (gmem.c:134)
==10395==    by 0x406F2D6: g_slice_alloc (gslice.c:836)
==10395==    by 0x406F31B: g_slice_alloc0 (gslice.c:848)
==10395==    by 0x403A751: g_error_new_valist (gerror.c:54)
==10395==    by 0x403AAD4: g_set_error (gerror.c:240)
==10395==    by 0x4230328: _g_local_file_output_stream_create (glocalfileoutputstream.c:628)
==10395==    by 0x4227A04: g_local_file_create_readwrite (glocalfile.c:1388)
==10395==    by 0x418974C: g_file_create_readwrite (gfile.c:1784)
==10395==    by 0x8049FCD: test_g_file_create_readwrite (readwrite.c:187)

Bug #628331.

gio/tests/readwrite.c

index 5113186..7836270 100644 (file)
@@ -186,7 +186,8 @@ test_g_file_create_readwrite (void)
   error = NULL;
   file_iostream = g_file_create_readwrite (file, 0, NULL, &error);
   g_assert (file_iostream == NULL);
-  g_assert (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_EXISTS));
+  g_assert_error (error, G_IO_ERROR, G_IO_ERROR_EXISTS);
+  g_error_free (error);
 
   g_unlink (tmp_file);
   file_iostream = g_file_create_readwrite (file, 0, NULL, &error);