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.
This commit is contained in:
Michael Tretter 2019-12-17 13:01:07 +01:00 committed by Wim Taymans
parent dfa8011ed4
commit 5fa7630934
2 changed files with 3 additions and 3 deletions

View file

@ -272,7 +272,7 @@ static void do_add_node(void *data)
nd->dev = new_node (self, nd); nd->dev = new_node (self, nd);
if (nd->dev) { if (nd->dev) {
if(self->list_only) 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 else
gst_device_provider_device_add (GST_DEVICE_PROVIDER (self), nd->dev); 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_context_destroy (c);
pw_loop_destroy (l); pw_loop_destroy (l);
return *self->devices; return self->devices;
failed: failed:
pw_loop_destroy (l); pw_loop_destroy (l);

View file

@ -96,7 +96,7 @@ struct _GstPipeWireDeviceProvider {
int error; int error;
gboolean end; gboolean end;
gboolean list_only; gboolean list_only;
GList **devices; GList *devices;
}; };
struct _GstPipeWireDeviceProviderClass { struct _GstPipeWireDeviceProviderClass {