From 2e21381177c4ae5c1abb02cd8db364075f901444 Mon Sep 17 00:00:00 2001 From: Grazvydas Ignotas Date: Sat, 16 May 2015 22:29:42 +0300 Subject: [PATCH] kernel32: Don't leak an event handle on errors. --- dlls/kernel32/change.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dlls/kernel32/change.c b/dlls/kernel32/change.c index f3aec8d2d05..781ccfede99 100644 --- a/dlls/kernel32/change.c +++ b/dlls/kernel32/change.c @@ -190,12 +190,14 @@ BOOL WINAPI ReadDirectoryChangesW( HANDLE handle, LPVOID buffer, DWORD len, BOOL return TRUE; WaitForSingleObjectEx( ov.hEvent, INFINITE, TRUE ); - CloseHandle( ov.hEvent ); if (returned) *returned = ios->Information; status = ios->u.Status; } + if (!overlapped) + CloseHandle( ov.hEvent ); + if (status != STATUS_SUCCESS) { SetLastError( RtlNtStatusToDosError(status) ); -- 2.11.4.GIT