From 156cf60be512c741427805c23ffb66476b6dec9d Mon Sep 17 00:00:00 2001 From: Thomas Faber Date: Wed, 1 Mar 2017 13:10:52 +0000 Subject: [PATCH] [NTOS:IO] - Avoid event leak in NtQueryInformationFile. CID 716584 svn path=/trunk/; revision=74013 --- reactos/ntoskrnl/io/iomgr/iofunc.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/reactos/ntoskrnl/io/iomgr/iofunc.c b/reactos/ntoskrnl/io/iomgr/iofunc.c index 9d99a82476b..eb32a4d715e 100644 --- a/reactos/ntoskrnl/io/iomgr/iofunc.c +++ b/reactos/ntoskrnl/io/iomgr/iofunc.c @@ -2240,8 +2240,17 @@ NtQueryInformationFile(IN HANDLE FileHandle, } _SEH2_END; - /* Unlock FO */ - IopUnlockFileObject(FileObject); + /* Free the event if we had one */ + if (LocalEvent) + { + ExFreePoolWithTag(Event, TAG_IO); + } + + /* If FO was locked, unlock it */ + if (FileObject->Flags & FO_SYNCHRONOUS_IO) + { + IopUnlockFileObject(FileObject); + } /* We're done with FastIO! */ ObDereferenceObject(FileObject); -- 2.17.1