* Don't leak the decoded instructions in case the device object cannot be

allocated.
* Remove accidentally added debug device id.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27461 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Michael Lotz 2008-09-12 18:02:07 +00:00
parent 8008c36e34
commit b57520d4a9

View File

@ -181,20 +181,21 @@ HIDDevice::MakeHIDDevice(usb_device device,
} }
// determine device type and create the device object // determine device type and create the device object
HIDDevice *hidDevice = NULL;
if (deviceType == USB_HID_DEVICE_TYPE_KEYBOARD) { if (deviceType == USB_HID_DEVICE_TYPE_KEYBOARD) {
return new(std::nothrow) KeyboardDevice(device, interruptPipe, hidDevice = new(std::nothrow) KeyboardDevice(device, interruptPipe,
interfaceIndex, finalInstructions, instructionCount, interfaceIndex, finalInstructions, instructionCount,
totalReportSize); totalReportSize);
} else if (deviceType == USB_HID_DEVICE_TYPE_MOUSE } else if (deviceType == USB_HID_DEVICE_TYPE_MOUSE) {
|| deviceType == 0x01250015) { hidDevice = new(std::nothrow) MouseDevice(device, interruptPipe,
return new(std::nothrow) MouseDevice(device, interruptPipe,
interfaceIndex, finalInstructions, instructionCount, interfaceIndex, finalInstructions, instructionCount,
totalReportSize); totalReportSize);
} } else
TRACE_ALWAYS("unsupported device type 0x%08lx\n", deviceType);
TRACE_ALWAYS("unsupported device type 0x%08lx\n", deviceType); if (hidDevice == NULL)
free(finalInstructions); free(finalInstructions);
return NULL; return hidDevice;
} }