From 8f91f1efe4d6261c696aee914ad2456dc2d9dd09 Mon Sep 17 00:00:00 2001 From: Jan Schmidt Date: Sat, 1 Oct 2022 04:55:49 +1000 Subject: [PATCH] gstbin: Fix a potential leak in gst_bin_do_deep_add_remove() If a child element of a bin is unparented while gst_bin_do_deep_add_remove() is iterating the children, don't leak a ref to it. Part-of: --- subprojects/gstreamer/gst/gstbin.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/subprojects/gstreamer/gst/gstbin.c b/subprojects/gstreamer/gst/gstbin.c index 116bd0f90d..423384175f 100644 --- a/subprojects/gstreamer/gst/gstbin.c +++ b/subprojects/gstreamer/gst/gstbin.c @@ -1142,8 +1142,9 @@ gst_bin_do_deep_add_remove (GstBin * bin, gint sig_id, const gchar * sig_name, " in bin %" GST_PTR_FORMAT, sig_name, e, parent); g_signal_emit (bin, sig_id, 0, parent, e); gst_object_unref (parent); - gst_object_unref (e); } + + gst_object_unref (e); } } gst_iterator_free (it);