Initialize uninitialized variable
This fixes a potentially undefined branch if the USB device list is empty. dev is NULL, the loop is never entered, 'r' isn't set. if (!dev && !r) is undefined.
This commit is contained in:
parent
e9e761565b
commit
df60eca33c
@ -260,7 +260,7 @@ get_usb_device (uint16_t vendor_id, uint16_t product_id, libusb_device** device)
|
||||
struct libusb_device **devs;
|
||||
struct libusb_device *dev;
|
||||
size_t i = 0;
|
||||
int r;
|
||||
int r = LIBUSB_ERROR_NO_DEVICE;
|
||||
|
||||
*device = 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user