Commit 1413f577 authored by Sven Baars's avatar Sven Baars Committed by Alexandre Julliard

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

parent b56d19d3
...@@ -123,6 +123,7 @@ NTSTATUS WINAPI PNP_AddDevice(DRIVER_OBJECT *driver, DEVICE_OBJECT *PDO) ...@@ -123,6 +123,7 @@ NTSTATUS WINAPI PNP_AddDevice(DRIVER_OBJECT *driver, DEVICE_OBJECT *PDO)
{ {
ERR("Minidriver AddDevice failed (%x)\n",status); ERR("Minidriver AddDevice failed (%x)\n",status);
HID_DeleteDevice(device); HID_DeleteDevice(device);
HeapFree(GetProcessHeap(), 0, hiddev);
return status; return status;
} }
...@@ -133,6 +134,7 @@ NTSTATUS WINAPI PNP_AddDevice(DRIVER_OBJECT *driver, DEVICE_OBJECT *PDO) ...@@ -133,6 +134,7 @@ NTSTATUS WINAPI PNP_AddDevice(DRIVER_OBJECT *driver, DEVICE_OBJECT *PDO)
{ {
ERR("Minidriver failed to get Attributes(%x)\n",status); ERR("Minidriver failed to get Attributes(%x)\n",status);
HID_DeleteDevice(device); HID_DeleteDevice(device);
HeapFree(GetProcessHeap(), 0, hiddev);
return status; return status;
} }
...@@ -147,6 +149,7 @@ NTSTATUS WINAPI PNP_AddDevice(DRIVER_OBJECT *driver, DEVICE_OBJECT *PDO) ...@@ -147,6 +149,7 @@ NTSTATUS WINAPI PNP_AddDevice(DRIVER_OBJECT *driver, DEVICE_OBJECT *PDO)
{ {
ERR("Cannot get Device Descriptor(%x)\n",status); ERR("Cannot get Device Descriptor(%x)\n",status);
HID_DeleteDevice(device); HID_DeleteDevice(device);
HeapFree(GetProcessHeap(), 0, hiddev);
return status; return status;
} }
for (i = 0; i < descriptor.bNumDescriptors; i++) for (i = 0; i < descriptor.bNumDescriptors; i++)
...@@ -157,6 +160,7 @@ NTSTATUS WINAPI PNP_AddDevice(DRIVER_OBJECT *driver, DEVICE_OBJECT *PDO) ...@@ -157,6 +160,7 @@ NTSTATUS WINAPI PNP_AddDevice(DRIVER_OBJECT *driver, DEVICE_OBJECT *PDO)
{ {
ERR("No Report Descriptor found in reply\n"); ERR("No Report Descriptor found in reply\n");
HID_DeleteDevice(device); HID_DeleteDevice(device);
HeapFree(GetProcessHeap(), 0, hiddev);
return status; return status;
} }
...@@ -168,6 +172,7 @@ NTSTATUS WINAPI PNP_AddDevice(DRIVER_OBJECT *driver, DEVICE_OBJECT *PDO) ...@@ -168,6 +172,7 @@ NTSTATUS WINAPI PNP_AddDevice(DRIVER_OBJECT *driver, DEVICE_OBJECT *PDO)
ERR("Cannot get Report Descriptor(%x)\n",status); ERR("Cannot get Report Descriptor(%x)\n",status);
HID_DeleteDevice(device); HID_DeleteDevice(device);
HeapFree(GetProcessHeap(), 0, reportDescriptor); HeapFree(GetProcessHeap(), 0, reportDescriptor);
HeapFree(GetProcessHeap(), 0, hiddev);
return status; return status;
} }
...@@ -178,6 +183,7 @@ NTSTATUS WINAPI PNP_AddDevice(DRIVER_OBJECT *driver, DEVICE_OBJECT *PDO) ...@@ -178,6 +183,7 @@ NTSTATUS WINAPI PNP_AddDevice(DRIVER_OBJECT *driver, DEVICE_OBJECT *PDO)
{ {
ERR("Cannot parse Report Descriptor\n"); ERR("Cannot parse Report Descriptor\n");
HID_DeleteDevice(device); HID_DeleteDevice(device);
HeapFree(GetProcessHeap(), 0, hiddev);
return STATUS_NOT_SUPPORTED; return STATUS_NOT_SUPPORTED;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment