libusb-compat-0.1
libusb-compat-0.1 copied to clipboard
libusb-compat-0.1 devices still referenced upon exit
Reference:
- https://github.com/libusb/libusb/issues/988
- https://github.com/libusb/libusb/issues/974
I am not so sure if this is an issue with libusb-compat-0.1 or libusb.
Reference:
- https://github.com/libusb/libusb/issues/988#issuecomment-1492954364
The following fix to libusb-compat-0.1 seems to fix the issue. But I am not so sure if it is the right fix or not.
mcuee@UbuntuSwift3:~/build/libusb-compat-0.1$ git diff
diff --git a/libusb/core.c b/libusb/core.c
index 3bc9c25..09068f3 100644
--- a/libusb/core.c
+++ b/libusb/core.c
@@ -584,14 +584,12 @@ static int initialize_device(struct usb_device *dev)
dev->num_children = 0;
dev->children = NULL;
- libusb_ref_device(newlib_dev);
return 0;
}
static void free_device(struct usb_device *dev)
{
clear_device(dev);
- libusb_unref_device(dev->dev);
free(dev);
}
Comments welcome.
@tormodvolden
Please take a look at the proposed fix. Thanks. It seems to me this is not a bug of libusb but rather libusb-compat-0.1.