From 70ee7293e09e361b03666c6617ab8041fe35413c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Thu, 19 Oct 2023 19:43:26 +0300 Subject: [PATCH] aggregator: Take pad lock while releasing buffers when removing pads Accessing the buffers in all other places requires the pad lock and not taking it here can cause access to already freed buffers if there's concurrent access from another thread. Part-of: --- subprojects/gstreamer/libs/gst/base/gstaggregator.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/subprojects/gstreamer/libs/gst/base/gstaggregator.c b/subprojects/gstreamer/libs/gst/base/gstaggregator.c index 64b59469c0..c38206d7e6 100644 --- a/subprojects/gstreamer/libs/gst/base/gstaggregator.c +++ b/subprojects/gstreamer/libs/gst/base/gstaggregator.c @@ -2122,7 +2122,9 @@ gst_aggregator_release_pad (GstElement * element, GstPad * pad) SRC_LOCK (self); gst_aggregator_pad_set_flushing (aggpad, GST_FLOW_FLUSHING, TRUE); + PAD_LOCK (aggpad); gst_buffer_replace (&aggpad->priv->peeked_buffer, NULL); + PAD_UNLOCK (aggpad); gst_element_remove_pad (element, pad); self->priv->has_peer_latency = FALSE;