From 5fa763093465e0a30dc3681c4e78c37b49cb6402 Mon Sep 17 00:00:00 2001 From: Michael Tretter Date: Tue, 17 Dec 2019 13:01:07 +0100 Subject: [PATCH] gst: fix NULL pointer when listing devices The gstdeviceprovider segfaults when listing the available devices, because it the pointer to GList * is initialized with NULL instead of the GList * itself. Don't use a pointer, but use the GList * directly. --- src/gst/gstpipewiredeviceprovider.c | 4 ++-- src/gst/gstpipewiredeviceprovider.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gst/gstpipewiredeviceprovider.c b/src/gst/gstpipewiredeviceprovider.c index 189676f98..a4a6b50a2 100644 --- a/src/gst/gstpipewiredeviceprovider.c +++ b/src/gst/gstpipewiredeviceprovider.c @@ -272,7 +272,7 @@ static void do_add_node(void *data) nd->dev = new_node (self, nd); if (nd->dev) { if(self->list_only) - *self->devices = g_list_prepend (*self->devices, gst_object_ref_sink (nd->dev)); + self->devices = g_list_prepend (self->devices, gst_object_ref_sink (nd->dev)); else gst_device_provider_device_add (GST_DEVICE_PROVIDER (self), nd->dev); } @@ -568,7 +568,7 @@ gst_pipewire_device_provider_probe (GstDeviceProvider * provider) pw_context_destroy (c); pw_loop_destroy (l); - return *self->devices; + return self->devices; failed: pw_loop_destroy (l); diff --git a/src/gst/gstpipewiredeviceprovider.h b/src/gst/gstpipewiredeviceprovider.h index e02683554..0e6df94d6 100644 --- a/src/gst/gstpipewiredeviceprovider.h +++ b/src/gst/gstpipewiredeviceprovider.h @@ -96,7 +96,7 @@ struct _GstPipeWireDeviceProvider { int error; gboolean end; gboolean list_only; - GList **devices; + GList *devices; }; struct _GstPipeWireDeviceProviderClass {