Skip to content

Commit

Permalink
fix: OSX List Make sure necessary cleanups such as uv_mutex_unlock ar…
Browse files Browse the repository at this point in the history
…e called always. (#2343)
  • Loading branch information
enami authored Nov 26, 2021
1 parent 9997085 commit fc93cb6
Showing 1 changed file with 12 additions and 16 deletions.
28 changes: 12 additions & 16 deletions packages/bindings/src/darwin_list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,27 +237,23 @@ static stDeviceListItem* GetSerialDevices() {
kernResult = IOCreatePlugInInterfaceForService(device, kIOUSBDeviceUserClientTypeID, kIOCFPlugInInterfaceID,
&plugInInterface, &score);

if ((kIOReturnSuccess != kernResult) || !plugInInterface) {
continue;
}
if ((kIOReturnSuccess == kernResult) && plugInInterface) {
// Use the plugin interface to retrieve the device interface.
res = (*plugInInterface)->QueryInterface(plugInInterface, CFUUIDGetUUIDBytes(kIOUSBDeviceInterfaceID),
reinterpret_cast<LPVOID*> (&deviceInterface));

// Use the plugin interface to retrieve the device interface.
res = (*plugInInterface)->QueryInterface(plugInInterface, CFUUIDGetUUIDBytes(kIOUSBDeviceInterfaceID),
reinterpret_cast<LPVOID*> (&deviceInterface));
// Now done with the plugin interface.
(*plugInInterface)->Release(plugInInterface);

// Now done with the plugin interface.
(*plugInInterface)->Release(plugInInterface);
if (!res && deviceInterface != NULL) {
// Extract the desired Information
ExtractUsbInformation(serialDevice, deviceInterface);

if (res || deviceInterface == NULL) {
continue;
// Release the Interface
(*deviceInterface)->Release(deviceInterface);
}
}

// Extract the desired Information
ExtractUsbInformation(serialDevice, deviceInterface);

// Release the Interface
(*deviceInterface)->Release(deviceInterface);

// Release the device
(void) IOObjectRelease(device);
}
Expand Down

0 comments on commit fc93cb6

Please sign in to comment.