Commit 87333253 authored by Frediano Ziglio's avatar Frediano Ziglio

usb-device-manager: Fix reference counting getting devices

spice_usb_device_manager_device_to_bdev increments usb device
counter. The function is just used to check for filter but
than the counter is not decremented causing the object to be
leaked later (or invalid reference counter anyway).
Decrement the counter in any case.
Signed-off-by: Frediano Ziglio's avatarFrediano Ziglio <>
Acked-by: 's avatarVictor Toso <>
parent 930d9204
Pipeline #53071 passed with stage
in 3 minutes and 32 seconds
......@@ -1012,8 +1012,12 @@ GPtrArray* spice_usb_device_manager_get_devices_with_filter(
if (rules) {
SpiceUsbBackendDevice *bdev =
spice_usb_device_manager_device_to_bdev(self, device);
if (spice_usb_backend_device_check_filter(bdev, rules, count) != 0)
gboolean filter_ok =
(spice_usb_backend_device_check_filter(bdev, rules, count) == 0);
if (!filter_ok) {
g_ptr_array_add(devices_copy, spice_usb_device_ref(device));
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment