diff options
author | Thiago Santos <ts.santos@sisa.samsung.com> | 2014-01-17 10:17:29 -0300 |
---|---|---|
committer | Thiago Santos <ts.santos@sisa.samsung.com> | 2014-01-17 11:33:28 -0300 |
commit | b08fe2a66aa1b8fcc60f0f29f15615fb3d08f687 (patch) | |
tree | d1aadf4eca9d4588db12a0651052f75b8bd9049a | |
parent | 4ad2ff71dba1d55c544d3b43ece7baa86be6ca0d (diff) | |
download | gstreamer-plugins-base-b08fe2a66aa1b8fcc60f0f29f15615fb3d08f687.tar.gz |
videodecoder: plug leak when frames are released on subclass stop
They end up stored in the 'pending_events' list and should be
freed after calling stop
-rw-r--r-- | gst-libs/gst/video/gstvideodecoder.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/gst-libs/gst/video/gstvideodecoder.c b/gst-libs/gst/video/gstvideodecoder.c index 7257feea0..dd8abe376 100644 --- a/gst-libs/gst/video/gstvideodecoder.c +++ b/gst-libs/gst/video/gstvideodecoder.c @@ -2082,13 +2082,30 @@ gst_video_decoder_change_state (GstElement * element, GstStateChange transition) ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); switch (transition) { - case GST_STATE_CHANGE_PAUSED_TO_READY: + case GST_STATE_CHANGE_PAUSED_TO_READY:{ + gboolean stopped = TRUE; + GST_VIDEO_DECODER_STREAM_LOCK (decoder); gst_video_decoder_reset (decoder, TRUE, TRUE); GST_VIDEO_DECODER_STREAM_UNLOCK (decoder); - if (decoder_class->stop && !decoder_class->stop (decoder)) + + if (decoder_class->stop) { + stopped = decoder_class->stop (decoder); + + /* the subclass might have released frames and events from freed frames + * are stored in the pending_events list */ + GST_VIDEO_DECODER_STREAM_LOCK (decoder); + g_list_free_full (decoder->priv->pending_events, (GDestroyNotify) + gst_event_unref); + decoder->priv->pending_events = NULL; + GST_VIDEO_DECODER_STREAM_UNLOCK (decoder); + } + + if (!stopped) goto stop_failed; + break; + } case GST_STATE_CHANGE_READY_TO_NULL: /* close device/library if needed */ if (decoder_class->close && !decoder_class->close (decoder)) |