mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-22 05:56:31 +00:00
bufferlist: fix buffer leak in _remove()
This commit is contained in:
parent
8528026c3b
commit
608fb56707
1 changed files with 9 additions and 2 deletions
|
@ -283,14 +283,21 @@ gst_buffer_list_insert (GstBufferList * list, gint idx, GstBuffer * buffer)
|
||||||
* @idx: the index
|
* @idx: the index
|
||||||
* @length: the amount to remove
|
* @length: the amount to remove
|
||||||
*
|
*
|
||||||
* Remove @length buffers starting from @idx in @list. The following buffers are
|
* Remove @length buffers starting from @idx in @list. The following buffers
|
||||||
* moved to close the gap.
|
* are moved to close the gap.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
gst_buffer_list_remove (GstBufferList * list, guint idx, guint length)
|
gst_buffer_list_remove (GstBufferList * list, guint idx, guint length)
|
||||||
{
|
{
|
||||||
|
GstBuffer *buf;
|
||||||
|
gint i;
|
||||||
|
|
||||||
g_return_if_fail (GST_IS_BUFFER_LIST (list));
|
g_return_if_fail (GST_IS_BUFFER_LIST (list));
|
||||||
g_return_if_fail (idx < list->array->len);
|
g_return_if_fail (idx < list->array->len);
|
||||||
|
|
||||||
|
for (i = idx; i < idx + length; ++i) {
|
||||||
|
buf = g_array_index (list->array, GstBuffer *, i);
|
||||||
|
gst_buffer_unref (buf);
|
||||||
|
}
|
||||||
g_array_remove_range (list->array, idx, length);
|
g_array_remove_range (list->array, idx, length);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue