hidclass.sys: Fix some memory leaks on error path (Coverity).

Signed-off-by: Sven Baars <sven.wine@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Sven Baars 2019-09-07 13:13:40 +02:00 committed by Alexandre Julliard
parent b56d19d3a0
commit 1413f577c5
1 changed files with 6 additions and 0 deletions

View File

@ -123,6 +123,7 @@ NTSTATUS WINAPI PNP_AddDevice(DRIVER_OBJECT *driver, DEVICE_OBJECT *PDO)
{
ERR("Minidriver AddDevice failed (%x)\n",status);
HID_DeleteDevice(device);
HeapFree(GetProcessHeap(), 0, hiddev);
return status;
}
@ -133,6 +134,7 @@ NTSTATUS WINAPI PNP_AddDevice(DRIVER_OBJECT *driver, DEVICE_OBJECT *PDO)
{
ERR("Minidriver failed to get Attributes(%x)\n",status);
HID_DeleteDevice(device);
HeapFree(GetProcessHeap(), 0, hiddev);
return status;
}
@ -147,6 +149,7 @@ NTSTATUS WINAPI PNP_AddDevice(DRIVER_OBJECT *driver, DEVICE_OBJECT *PDO)
{
ERR("Cannot get Device Descriptor(%x)\n",status);
HID_DeleteDevice(device);
HeapFree(GetProcessHeap(), 0, hiddev);
return status;
}
for (i = 0; i < descriptor.bNumDescriptors; i++)
@ -157,6 +160,7 @@ NTSTATUS WINAPI PNP_AddDevice(DRIVER_OBJECT *driver, DEVICE_OBJECT *PDO)
{
ERR("No Report Descriptor found in reply\n");
HID_DeleteDevice(device);
HeapFree(GetProcessHeap(), 0, hiddev);
return status;
}
@ -168,6 +172,7 @@ NTSTATUS WINAPI PNP_AddDevice(DRIVER_OBJECT *driver, DEVICE_OBJECT *PDO)
ERR("Cannot get Report Descriptor(%x)\n",status);
HID_DeleteDevice(device);
HeapFree(GetProcessHeap(), 0, reportDescriptor);
HeapFree(GetProcessHeap(), 0, hiddev);
return status;
}
@ -178,6 +183,7 @@ NTSTATUS WINAPI PNP_AddDevice(DRIVER_OBJECT *driver, DEVICE_OBJECT *PDO)
{
ERR("Cannot parse Report Descriptor\n");
HID_DeleteDevice(device);
HeapFree(GetProcessHeap(), 0, hiddev);
return STATUS_NOT_SUPPORTED;
}