Nikolay Sivov : hidclass: Fix handle leak on error path (Coverity).

Alexandre Julliard julliard at winehq.org
Wed Aug 24 12:05:17 CDT 2016


Module: wine
Branch: master
Commit: 026353bf7bc2f357d0fbf2fa6398262c01859fca
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=026353bf7bc2f357d0fbf2fa6398262c01859fca

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Tue Aug 23 00:05:36 2016 +0300

hidclass: Fix handle leak on error path (Coverity).

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Aric Stewart <aric at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 87cd94e..7df8374 100644
--- a/dlls/hidclass.sys/pnp.c
+++ b/dlls/hidclass.sys/pnp.c
@@ -47,14 +47,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;




More information about the wine-cvs mailing list