mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-18 15:51:11 +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
39de78c996
commit
4c87b6ee84
1 changed files with 1 additions and 3 deletions
|
@ -2389,12 +2389,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