From 4ad1c8b7c92d36fb454f7bb83c6ce08364eb7172 Mon Sep 17 00:00:00 2001 From: "Jan Alexander Steffens (heftig)" Date: Thu, 6 May 2021 12:54:46 +0200 Subject: [PATCH] multiqueue: Ensure peer pad exists when iterating internal links The pads can be NULL when we're racing with pad removal, e.g. when the pads get removed between `gst_pad_iterate_internal_links` acquiring the parent element and `gst_multi_queue_iterate_internal_links` locking the multiqueue. Part-of: --- plugins/elements/gstmultiqueue.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/elements/gstmultiqueue.c b/plugins/elements/gstmultiqueue.c index 917fc2fb12..bc86999c8e 100644 --- a/plugins/elements/gstmultiqueue.c +++ b/plugins/elements/gstmultiqueue.c @@ -1144,11 +1144,11 @@ gst_multi_queue_iterate_internal_links (GstPad * pad, GstObject * parent) srcpad = g_weak_ref_get (&squeue->srcpad); sinkpad = g_weak_ref_get (&squeue->sinkpad); - if (sinkpad == pad) { + if (sinkpad == pad && srcpad) { opad = srcpad; gst_clear_object (&sinkpad); - } else if (srcpad == pad) { + } else if (srcpad == pad && sinkpad) { opad = sinkpad; gst_clear_object (&srcpad);