mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 03:32:46 +00:00
libusb: early return if we fail to get a config descriptor, otherwise the memory returned is invalid (and should not be freed either)
This commit is contained in:
parent
1f58d9cd1f
commit
61bd9d7d70
@ -165,7 +165,13 @@ static void libusb_get_description(struct libusb_device *device,
|
||||
unsigned i, k;
|
||||
struct libusb_config_descriptor *config;
|
||||
|
||||
libusb_get_config_descriptor(device, 0, &config);
|
||||
int desc_ret = libusb_get_config_descriptor(device, 0, &config);
|
||||
|
||||
if (desc_ret != 0)
|
||||
{
|
||||
RARCH_ERR("Error %d getting libusb config descriptor\n", desc_ret);
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < (int)config->bNumInterfaces; i++)
|
||||
{
|
||||
@ -208,11 +214,12 @@ static void libusb_get_description(struct libusb_device *device,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
goto ret;
|
||||
}
|
||||
}
|
||||
|
||||
ret:
|
||||
ret:
|
||||
libusb_free_config_descriptor(config);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user