Skip to content

Commit

Permalink
fixup! refactor: improve HidEnumerator memory safety
Browse files Browse the repository at this point in the history
  • Loading branch information
Swiftb0y committed Sep 9, 2024
1 parent 776d90d commit 360b71f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/controllers/hid/hidenumerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@ QList<Controller*> HidEnumerator::queryDevices() {
auto device_info_list = std::unique_ptr<hid_device_info,
decltype([](hid_device_info* dev) { hid_free_enumeration(dev); })>(
hid_enumerate(0x0, 0x0));
for (const auto* device_info = device_info_list.get();
device_info;
device_info = device_info->next) {
auto deviceInfo = mixxx::hid::DeviceInfo(*device_info);
for (const auto* pDeviceInfo = device_info_list.get();
pDeviceInfo;
pDeviceInfo = pDeviceInfo->next) {
auto deviceInfo = mixxx::hid::DeviceInfo(*pDeviceInfo);
// The hidraw backend of hidapi on Linux returns many duplicate hid_device_info's from hid_enumerate,
// so filter them out.
// https://github.com/libusb/hidapi/issues/298
Expand All @@ -103,7 +103,7 @@ QList<Controller*> HidEnumerator::queryDevices() {
continue;
}

if (!recognizeDevice(*device_info)) {
if (!recognizeDevice(*pDeviceInfo)) {
qInfo()
<< "Excluding HID device"
<< deviceInfo;
Expand Down

0 comments on commit 360b71f

Please sign in to comment.