[PATCH] hidclass.sys: add missing case/missing heapfree (Coverity)

Marcus Meissner marcus at jet.franken.de
Wed Apr 20 13:16:21 CDT 2016


1358558 Resource leak

(actually switch on the enum, then the compiler will see missing cases)

Signed-off-by: Marcus Meissner <marcus at jet.franken.de>
---
 dlls/hidclass.sys/pnp.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/dlls/hidclass.sys/pnp.c b/dlls/hidclass.sys/pnp.c
index d97184f..9ada261 100644
--- a/dlls/hidclass.sys/pnp.c
+++ b/dlls/hidclass.sys/pnp.c
@@ -295,7 +295,7 @@ NTSTATUS WINAPI HID_PNP_Dispatch(DEVICE_OBJECT *device, IRP *irp)
             ULONG type = irpsp->Parameters.QueryId.IdType;
             WCHAR *id = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WCHAR)*REGSTR_VAL_MAX_HCID_LEN);
             TRACE("IRP_MN_QUERY_ID[%i]\n", type);
-            switch (type)
+            switch (irpsp->Parameters.QueryId.IdType)
             {
                 case BusQueryHardwareIDs:
                 case BusQueryCompatibleIDs:
@@ -326,6 +326,10 @@ NTSTATUS WINAPI HID_PNP_Dispatch(DEVICE_OBJECT *device, IRP *irp)
                     irp->IoStatus.Information = (ULONG_PTR)id;
                     rc = STATUS_SUCCESS;
                     break;
+                case BusQueryDeviceSerialNumber:
+                    FIXME("BusQueryDeviceSerialNumber not implemented\n");
+                    HeapFree(GetProcessHeap(), 0, id);
+                    break; 
             }
             break;
         }
-- 
2.8.1




More information about the wine-patches mailing list