From e72434ba203aabbcd66247a13e0e2f263ef005dc Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim-Philipp=20M=C3=BCller?= Date: Tue, 14 Jun 2022 17:29:31 +0100 Subject: [PATCH] multiqueue: fix potential crash on shutdown MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The mq we get out of the weak ref might be NULL if we're shutting down, which could cause assertion failures or crashes. It might also cause miscompilations where the compiler just optimises away the NULL check because it jumps to a code path that then dereferences the pointer which clearly isn't going to work. Seems like something like this happens with gcc 11. Fixes #1262 Co-authored-by: Doug Nazar Co-authored-by: Sebastian Dröge Part-of: --- subprojects/gstreamer/plugins/elements/gstmultiqueue.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/subprojects/gstreamer/plugins/elements/gstmultiqueue.c b/subprojects/gstreamer/plugins/elements/gstmultiqueue.c index a4bd1ed..10ad203 100644 --- a/subprojects/gstreamer/plugins/elements/gstmultiqueue.c +++ b/subprojects/gstreamer/plugins/elements/gstmultiqueue.c @@ -2129,7 +2129,7 @@ gst_multi_queue_loop (GstPad * pad) srcpad = g_weak_ref_get (&sq->srcpad); if (!mq || !srcpad) - goto out_flushing; + goto done; next: GST_DEBUG_OBJECT (mq, "SingleQueue %d : trying to pop an object", sq->id); @@ -2446,7 +2446,7 @@ gst_multi_queue_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer) mq = g_weak_ref_get (&sq->mqueue); if (!mq) - goto flushing; + goto done; /* if eos, we are always full, so avoid hanging incoming indefinitely */ if (sq->is_eos) -- 2.7.4