mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-19 16:21:17 +00:00
inputselector: fix cached buffer leak in chain function
gst_selector_pad_chain() was popping cached buffers out of the queue without freeing those. Make sure we don't steal the GstBuffer as the cached buffer ref has been passed to the pad chain function. This can be reproduced by running the validate.file.playback.switch_subtitle_track_while_paused.test5_mkv scenario with Valgrind. https://bugzilla.gnome.org/show_bug.cgi?id=747611 Signed-off-by: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
This commit is contained in:
parent
0865bc02ea
commit
b15e6f4bf0
1 changed files with 6 additions and 1 deletions
|
@ -364,7 +364,8 @@ gst_selector_pad_new_cached_buffer (GstSelectorPad * selpad, GstBuffer * buffer)
|
|||
static void
|
||||
gst_selector_pad_free_cached_buffer (GstSelectorPadCachedBuffer * cached_buffer)
|
||||
{
|
||||
gst_buffer_unref (cached_buffer->buffer);
|
||||
if (cached_buffer->buffer)
|
||||
gst_buffer_unref (cached_buffer->buffer);
|
||||
g_slice_free (GstSelectorPadCachedBuffer, cached_buffer);
|
||||
}
|
||||
|
||||
|
@ -971,6 +972,10 @@ gst_selector_pad_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
|
|||
gst_selector_pad_chain (pad, parent, cached_buffer->buffer);
|
||||
GST_INPUT_SELECTOR_LOCK (sel);
|
||||
|
||||
/* We just passed the ownership of the buffer to the chain function */
|
||||
cached_buffer->buffer = NULL;
|
||||
gst_selector_pad_free_cached_buffer (cached_buffer);
|
||||
|
||||
/* we may have cleaned up the queue in the meantime because of
|
||||
* old buffers */
|
||||
if (!selpad->cached_buffers) {
|
||||
|
|
Loading…
Reference in a new issue