[PATCH] hidclass: Fix handle leak on error path (Coverity)

Nikolay Sivov nsivov at codeweavers.com
Mon Aug 22 16:05:36 CDT 2016


Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
 dlls/hidclass.sys/pnp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/dlls/hidclass.sys/pnp.c b/dlls/hidclass.sys/pnp.c
index 8fd5c17..421737d 100644
--- a/dlls/hidclass.sys/pnp.c
+++ b/dlls/hidclass.sys/pnp.c
@@ -58,14 +58,14 @@ static NTSTATUS get_device_id(DEVICE_OBJECT *device, BUS_QUERY_ID_TYPE type, WCH
     NTSTATUS status;
     IO_STACK_LOCATION *irpsp;
     IO_STATUS_BLOCK irp_status;
+    HANDLE event;
     IRP *irp;
-    HANDLE event = CreateEventA(NULL, FALSE, FALSE, NULL);
 
     irp = IoBuildSynchronousFsdRequest(IRP_MJ_PNP, device, NULL, 0, NULL, NULL, &irp_status);
     if (irp == NULL)
         return STATUS_NO_MEMORY;
 
-    irp->UserEvent = event;
+    irp->UserEvent = event = CreateEventA(NULL, FALSE, FALSE, NULL);
     irpsp = IoGetNextIrpStackLocation(irp);
     irpsp->MinorFunction = IRP_MN_QUERY_ID;
     irpsp->Parameters.QueryId.IdType = type;
-- 
2.9.3




More information about the wine-patches mailing list