13
0

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:
Robin Gareus 2019-08-21 03:05:17 +02:00
parent e9e761565b
commit df60eca33c
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -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 **devs;
struct libusb_device *dev; struct libusb_device *dev;
size_t i = 0; size_t i = 0;
int r; int r = LIBUSB_ERROR_NO_DEVICE;
*device = 0; *device = 0;