Plug a mem leak in data-input-stream test

==2415== 165 (72 direct, 93 indirect) bytes in 3 blocks are definitely lost in loss record 373 of 399
==2415==    at 0x4005BDC: malloc (vg_replace_malloc.c:195)
==2415==    by 0x4057094: g_malloc (gmem.c:134)
==2415==    by 0x406F2D6: g_slice_alloc (gslice.c:836)
==2415==    by 0x406F31B: g_slice_alloc0 (gslice.c:848)
==2415==    by 0x403A8A6: g_error_new_literal (gerror.c:117)
==2415==    by 0x403AC31: g_set_error_literal (gerror.c:314)
==2415==    by 0x417ED29: read_data (gdatainputstream.c:309)
==2415==    by 0x417EE9D: g_data_input_stream_read_byte (gdatainputstream.c:344)
==2415==    by 0x8049DEC: test_data_array (data-input-stream.c:263)

Bug #628331.
This commit is contained in:
Christian Persch 2010-09-03 15:45:48 -04:00 committed by Matthias Clasen
parent 31b15451cf
commit 91e3803596

View File

@ -296,13 +296,15 @@ test_data_array (GInputStream *stream, GInputStream *base_stream,
g_assert_not_reached ();
break;
}
if ((data) && (! error))
if (!error)
g_assert_cmpint (data, ==, TEST_DATA_RETYPE_BUFF(data_type, gint64, ((guchar*)buffer + pos)));
pos += data_size;
}
if (pos < len + 1)
g_assert_no_error (error);
if (error)
g_error_free (error);
g_assert_cmpint (pos - data_size, ==, len);
}