From 0596d637e2aecd542f3d1b98da7d8ed7d323d556 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 a1a5b2d85a..b32b89508c 100644 --- a/subprojects/gstreamer/libs/gst/base/gstaggregator.c +++ b/subprojects/gstreamer/libs/gst/base/gstaggregator.c @@ -2032,7 +2032,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;