diff --git a/Foundation/src/Process_WINCE.cpp b/Foundation/src/Process_WINCE.cpp index 49604287a..4b365773c 100644 --- a/Foundation/src/Process_WINCE.cpp +++ b/Foundation/src/Process_WINCE.cpp @@ -211,10 +211,19 @@ bool ProcessImpl::isRunningImpl(PIDImpl pid) { HANDLE hProc = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, pid); bool result = true; - DWORD exitCode; - BOOL rc = GetExitCodeProcess(hProc, &exitCode); - if (!rc || exitCode != STILL_ACTIVE) result = false; - return result;} + if (hProc) + { + DWORD exitCode; + BOOL rc = GetExitCodeProcess(hProc, &exitCode); + if (!rc || exitCode != STILL_ACTIVE) result = false; + CloseHandle(hProc); + } + else + { + result = false; + } + return result; +} void ProcessImpl::requestTerminationImpl(PIDImpl pid)