diff options
author | Jan Alexander Steffens (heftig) <jan.steffens@ltnglobal.com> | 2021-10-04 14:49:44 +0300 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.com> | 2021-10-31 15:28:35 +0300 |
commit | 516f9592e7249fd6139e6493596d438f5b2b7ba5 (patch) | |
tree | 8b31dac6bf2cf186792e26780795d45a775e1ca4 | |
parent | 3419ad9a457fee430ec86fc3bba85359e458326f (diff) |
multiqueue: Fix query unref race on flush
If the query has already been destroyed at this point, GST_IS_QUERY will
read garbage, can return false and we will try to unref it again.
Instead, make note of whether the item is a query when we dequeue it.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1284>
-rw-r--r-- | plugins/elements/gstmultiqueue.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/plugins/elements/gstmultiqueue.c b/plugins/elements/gstmultiqueue.c index 037d918e49..9135604fa2 100644 --- a/plugins/elements/gstmultiqueue.c +++ b/plugins/elements/gstmultiqueue.c @@ -2087,7 +2087,7 @@ gst_multi_queue_loop (GstPad * pad) guint32 newid; GstFlowReturn result; GstClockTimeDiff next_time; - gboolean is_buffer; + gboolean is_buffer, is_query; gboolean do_update_buffering = FALSE; gboolean dropping = FALSE; GstPad *srcpad = NULL; @@ -2113,6 +2113,8 @@ next: item = (GstMultiQueueItem *) sitem; newid = item->posid; + is_query = item->is_query; + /* steal the object and destroy the item */ object = gst_multi_queue_item_steal_object (item); gst_multi_queue_item_destroy (item); @@ -2358,7 +2360,7 @@ done: out_flushing: { - if (object && !GST_IS_QUERY (object)) + if (object && !is_query) gst_mini_object_unref (object); GST_MULTI_QUEUE_MUTEX_LOCK (mq); |