tests: fix crash and leak in bufferlists unit test

Don't access already-freed iterator, makes check-valgrind work and fixes
crash on PPC; unref buffer we're going to steal to make valgrind happy.
This commit is contained in:
Tim-Philipp Müller 2009-06-21 00:26:33 +01:00
parent c2e980f827
commit 2b4d127ca0

View file

@ -688,6 +688,7 @@ foreach_func4 (GstBuffer ** buffer, guint group, guint idx, ForeachData * data)
fail_unless (buffer != NULL);
fail_unless (*buffer == data->buf[group][idx]);
gst_buffer_unref (*buffer);
*buffer = NULL;
data->iter++;
@ -720,7 +721,6 @@ GST_START_TEST (test_foreach)
data.buf[1][1] = gst_buffer_new ();
gst_buffer_list_iterator_add (it, data.buf[1][1]);
gst_buffer_list_iterator_free (it);
gst_buffer_list_iterator_add_group (it);
fail_unless (gst_buffer_list_get (list, 0, 0) == data.buf[0][0]);
fail_unless (gst_buffer_list_get (list, 0, 1) == NULL);