mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-31 22:25:38 -04:00
gst: deviceprovider: Fix a leak and a heap-use-after-free
The device passed to gst_device_provider_device_add() is transfer:floating, so we need increase its ref, otherwise the pointer we keep internally will be a dangling ref. Also gst_device_provider_device_remove() doesn't actually release the device, so we have to do it ourselves. Fixes #4616
This commit is contained in:
parent
58c412c9dc
commit
81408597f4
1 changed files with 3 additions and 1 deletions
|
|
@ -327,6 +327,7 @@ static void do_add_nodes(GstPipeWireDeviceProvider *self)
|
|||
gst_object_ref_sink (device),
|
||||
compare_device_session_priority);
|
||||
} else {
|
||||
gst_object_ref (device);
|
||||
gst_device_provider_device_add (GST_DEVICE_PROVIDER (self), device);
|
||||
}
|
||||
}
|
||||
|
|
@ -484,7 +485,8 @@ destroy_node (void *data)
|
|||
}
|
||||
|
||||
if (nd->dev != NULL) {
|
||||
gst_device_provider_device_remove (provider, GST_DEVICE (nd->dev));
|
||||
gst_device_provider_device_remove (provider, nd->dev);
|
||||
gst_clear_object (&nd->dev);
|
||||
}
|
||||
if (nd->caps)
|
||||
gst_caps_unref(nd->caps);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue