gstdeviceprovider: fix leaking hidden providers

Free list of hidden providers upon stop and dispose.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7912>
This commit is contained in:
Robert Rosengren 2024-11-18 08:47:12 +01:00
parent 5b32fe7b24
commit 6fff1ef971

View file

@ -179,8 +179,8 @@ gst_device_provider_dispose (GObject * object)
gst_object_replace ((GstObject **) & provider->priv->bus, NULL);
GST_OBJECT_LOCK (provider);
g_list_free_full (provider->devices, (GDestroyNotify) gst_object_unparent);
provider->devices = NULL;
g_clear_list (&provider->devices, (GDestroyNotify) gst_object_unparent);
g_clear_list (&provider->priv->hidden_providers, (GDestroyNotify) g_free);
GST_OBJECT_UNLOCK (provider);
G_OBJECT_CLASS (gst_device_provider_parent_class)->dispose (object);
@ -534,8 +534,8 @@ gst_device_provider_stop (GstDeviceProvider * provider)
if (klass->stop)
klass->stop (provider);
GST_OBJECT_LOCK (provider);
g_list_free_full (provider->devices, (GDestroyNotify) gst_object_unparent);
provider->devices = NULL;
g_clear_list (&provider->devices, (GDestroyNotify) gst_object_unparent);
g_clear_list (&provider->priv->hidden_providers, (GDestroyNotify) g_free);
GST_OBJECT_UNLOCK (provider);
} else if (provider->priv->started_count < 1) {
g_critical