[PATCH] hidclass.sys: avoid leaking event in error path (Coverity)

Marcus Meissner marcus at jet.franken.de
Mon Aug 22 16:19:20 CDT 2016


1371732 Resource leak

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

diff --git a/dlls/hidclass.sys/pnp.c b/dlls/hidclass.sys/pnp.c
index 8fd5c17..8ad0d6e 100644
--- a/dlls/hidclass.sys/pnp.c
+++ b/dlls/hidclass.sys/pnp.c
@@ -62,8 +62,10 @@ static NTSTATUS get_device_id(DEVICE_OBJECT *device, BUS_QUERY_ID_TYPE type, WCH
     HANDLE event = CreateEventA(NULL, FALSE, FALSE, NULL);
 
     irp = IoBuildSynchronousFsdRequest(IRP_MJ_PNP, device, NULL, 0, NULL, NULL, &irp_status);
-    if (irp == NULL)
+    if (irp == NULL) {
+        CloseHandle(event);
         return STATUS_NO_MEMORY;
+    }
 
     irp->UserEvent = event;
     irpsp = IoGetNextIrpStackLocation(irp);
-- 
2.9.3




More information about the wine-patches mailing list