Fix potential crash when libusb_detach_kernel_driver fails #363
No reviewers
Labels
No labels
3rdparty
Android
API
Author does not respond
bsd
bug
build system/CI
ci-virtual-device
CMake
Contributions Welcome
Core
dependencies
device-specific
documentation
don't_merge
duplicate
enhancement
Example
Haiku
hidraw
hotplug
info required
invalid
libusb
macOS
Misc
Not an issue
question
Release
Test
Test GUI
Windows
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-libusb/hidapi!363
Loading…
Reference in a new issue
No description provided.
Delete branch "fix-crash"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
In case if libusb_detach_kernel_driver fails inside hidapi_initialize_device
HIDAPI had tried to
libusb_close(dev->device_handle)two times:libusb_detach_kernel_driver;hidapi_initialize_devicefunction;The fix:
libusb_closethe device only once.And since
hidapi_initialize_deviceis not responsible for opening the device -it is not responsible for closing it either.