It would have been more sensible to move libusb_free_device_list() to the end of the function, perhaps (goto cleanup or something). ack anyway On Mon, Jul 9, 2012 at 2:14 PM, Uri Lublin <uril@xxxxxxxxxx> wrote: > In preparation for a different SpiceUsbDevice. > --- > gtk/usb-device-manager.c | 15 +++++++++------ > 1 files changed, 9 insertions(+), 6 deletions(-) > > diff --git a/gtk/usb-device-manager.c b/gtk/usb-device-manager.c > index c50a7da..a81db57 100644 > --- a/gtk/usb-device-manager.c > +++ b/gtk/usb-device-manager.c > @@ -543,6 +543,7 @@ static void spice_usb_device_manager_add_dev(SpiceUsbDeviceManager *self, > libusb_device *device = NULL, **dev_list = NULL; > const gchar *devtype, *devclass; > int i, bus, address; > + gboolean auto_ok = FALSE; > > devtype = g_udev_device_get_property(udev, "DEVTYPE"); > /* Check if this is a usb device (and not an interface) */ > @@ -572,6 +573,13 @@ static void spice_usb_device_manager_add_dev(SpiceUsbDeviceManager *self, > } > } > > + if (device && priv->auto_connect) { > + auto_ok = usbredirhost_check_device_filter( > + priv->auto_conn_filter_rules, > + priv->auto_conn_filter_rules_count, > + device, 0) == 0; > + } > + > if (!priv->coldplug_list) > libusb_free_device_list(dev_list, 1); > > @@ -584,16 +592,11 @@ static void spice_usb_device_manager_add_dev(SpiceUsbDeviceManager *self, > g_ptr_array_add(priv->devices, device); > > if (priv->auto_connect) { > - gboolean can_redirect, auto_ok; > + gboolean can_redirect; > > can_redirect = spice_usb_device_manager_can_redirect_device( > self, (SpiceUsbDevice *)device, NULL); > > - auto_ok = usbredirhost_check_device_filter( > - priv->auto_conn_filter_rules, > - priv->auto_conn_filter_rules_count, > - device, 0) == 0; > - > if (can_redirect && auto_ok) > spice_usb_device_manager_connect_device_async(self, > (SpiceUsbDevice *)device, NULL, > -- > 1.7.1 > > _______________________________________________ > Spice-devel mailing list > Spice-devel@xxxxxxxxxxxxxxxxxxxxx > http://lists.freedesktop.org/mailman/listinfo/spice-devel -- Marc-André Lureau _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/spice-devel