From 7bcad37568ce1b21c2a949206f3edb4f9f58fbfd Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Sun, 12 Nov 2023 05:59:14 +1100 Subject: [PATCH] [host] platform: Close the exitEvent when done --- host/platform/Windows/src/platform.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/host/platform/Windows/src/platform.c b/host/platform/Windows/src/platform.c index c1f50283..88d3c897 100644 --- a/host/platform/Windows/src/platform.c +++ b/host/platform/Windows/src/platform.c @@ -558,10 +558,14 @@ bool app_init(void) } } - if (exitEvent && - !RegisterWaitForSingleObject(&app.exitWait, exitEvent, exitEventCallback, NULL, - INFINITE, WT_EXECUTEONLYONCE)) - DEBUG_WINERROR("Failed to register wait for exit event", GetLastError()); + if (exitEvent) + { + if (!RegisterWaitForSingleObject( + &app.exitWait, exitEvent, exitEventCallback, NULL, + INFINITE, WT_EXECUTEONLYONCE)) + DEBUG_WINERROR("Failed to register wait for exit event", GetLastError()); + CloseHandle(exitEvent); + } return true; }