mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-25 03:01:03 +00:00
buffer: Fix memory corruption in gst_buffer_foreach_meta() when removing metas
Fix corruption of meta list head when removing metas at the beginning during iteration. Linked list handling in gst_buffer_foreach_meta failed to track the previous entry and update the correct next pointer when removing items from beyond the head of the list, resulting in arbitrary list pointer corruption. Closes #332
This commit is contained in:
parent
5ba3595763
commit
6318e7c675
1 changed files with 1 additions and 3 deletions
|
@ -2437,12 +2437,10 @@ gst_buffer_foreach_meta (GstBuffer * buffer, GstBufferForeachMetaFunc func,
|
|||
|
||||
/* remove from list */
|
||||
if (GST_BUFFER_META (buffer) == walk)
|
||||
GST_BUFFER_META (buffer) = next;
|
||||
prev = GST_BUFFER_META (buffer) = next;
|
||||
else
|
||||
prev->next = next;
|
||||
|
||||
prev = next;
|
||||
|
||||
/* call free_func if any */
|
||||
if (info->free_func)
|
||||
info->free_func (m, buffer);
|
||||
|
|
Loading…
Reference in a new issue