audiobasesink: fix ring buffer leak on open failure

This commit is contained in:
Vincent Penquerc'h 2015-04-09 13:00:02 +01:00
parent 4e6b917ba3
commit 5cb40d7320

View file

@ -2225,8 +2225,13 @@ gst_audio_base_sink_change_state (GstElement * element,
sink->ringbuffer = rb; sink->ringbuffer = rb;
GST_OBJECT_UNLOCK (sink); GST_OBJECT_UNLOCK (sink);
if (!gst_audio_ring_buffer_open_device (sink->ringbuffer)) if (!gst_audio_ring_buffer_open_device (sink->ringbuffer)) {
GST_OBJECT_LOCK (sink);
gst_object_unparent (GST_OBJECT_CAST (sink->ringbuffer));
sink->ringbuffer = NULL;
GST_OBJECT_UNLOCK (sink);
goto open_failed; goto open_failed;
}
break; break;
} }
case GST_STATE_CHANGE_READY_TO_PAUSED: case GST_STATE_CHANGE_READY_TO_PAUSED: