bufferlist: avoid reading past the array

When the foreach function told us to remove the buffer from the list, decrease
the length of the array or else we might read past the last item in the array.
This commit is contained in:
Wim Taymans 2011-11-23 17:38:24 +01:00
parent e694f5e71c
commit 03cdd32b33

View file

@ -210,6 +210,7 @@ gst_buffer_list_foreach (GstBufferList * list, GstBufferListFunc func,
if (buf != buf_ret) { if (buf != buf_ret) {
if (buf_ret == NULL) { if (buf_ret == NULL) {
g_array_remove_index (list->array, i); g_array_remove_index (list->array, i);
len--;
} else { } else {
g_array_index (list->array, GstBuffer *, i) = buf_ret; g_array_index (list->array, GstBuffer *, i) = buf_ret;
} }