diff --git a/packages/bindings/src/darwin_list.cpp b/packages/bindings/src/darwin_list.cpp index a3f5d65d2..6e1a8494a 100644 --- a/packages/bindings/src/darwin_list.cpp +++ b/packages/bindings/src/darwin_list.cpp @@ -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 (&deviceInterface)); - // Use the plugin interface to retrieve the device interface. - res = (*plugInInterface)->QueryInterface(plugInInterface, CFUUIDGetUUIDBytes(kIOUSBDeviceInterfaceID), - reinterpret_cast (&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); }