queue: Illegal memory access of sink event

Once event is pushed to pad, then queue should not access the event.
This is leading to invalid read valgrind errors

https://bugzilla.gnome.org/show_bug.cgi?id=759430
This commit is contained in:
Vineeth TM 2015-12-14 10:32:14 +09:00 committed by Sebastian Dröge
parent 615af0b1b0
commit 78614c505a

View file

@ -902,10 +902,11 @@ gst_queue_handle_sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
{ {
gboolean ret = TRUE; gboolean ret = TRUE;
GstQueue *queue; GstQueue *queue;
GstEventType event_type = GST_EVENT_TYPE (event);
queue = GST_QUEUE (parent); queue = GST_QUEUE (parent);
switch (GST_EVENT_TYPE (event)) { switch (event_type) {
case GST_EVENT_FLUSH_START: case GST_EVENT_FLUSH_START:
STATUS (queue, pad, "received flush start event"); STATUS (queue, pad, "received flush start event");
/* forward event */ /* forward event */
@ -960,7 +961,7 @@ gst_queue_handle_sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
if (!GST_EVENT_IS_STICKY (event)) { if (!GST_EVENT_IS_STICKY (event)) {
GST_QUEUE_MUTEX_UNLOCK (queue); GST_QUEUE_MUTEX_UNLOCK (queue);
goto out_flow_error; goto out_flow_error;
} else if (GST_EVENT_TYPE (event) == GST_EVENT_EOS) { } else if (event_type == GST_EVENT_EOS) {
if (queue->srcresult == GST_FLOW_NOT_LINKED if (queue->srcresult == GST_FLOW_NOT_LINKED
|| queue->srcresult < GST_FLOW_EOS) { || queue->srcresult < GST_FLOW_EOS) {
GST_QUEUE_MUTEX_UNLOCK (queue); GST_QUEUE_MUTEX_UNLOCK (queue);
@ -986,7 +987,7 @@ gst_queue_handle_sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
break; break;
} }
if (ret == FALSE) { if (ret == FALSE) {
if (GST_EVENT_TYPE (event) == GST_EVENT_CAPS) if (event_type == GST_EVENT_CAPS)
return GST_FLOW_NOT_NEGOTIATED; return GST_FLOW_NOT_NEGOTIATED;
return GST_FLOW_ERROR; return GST_FLOW_ERROR;
} }