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: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5553>
This commit is contained in:
Sebastian Dröge 2023-10-19 19:43:26 +03:00 committed by Tim-Philipp Müller
parent 8419c1e6dc
commit 0596d637e2

View file

@ -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;