From 0825cd0f203af00a074203dde469bf40102e821d Mon Sep 17 00:00:00 2001 From: Al12rs Date: Tue, 31 Oct 2017 23:20:06 +0100 Subject: Added !found condition to for loop to ensure that a valid processHandle can't be overwritten to avoid handle leaks. --- src/organizercore.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/organizercore.cpp b/src/organizercore.cpp index 48e2f98a..05da9f83 100644 --- a/src/organizercore.cpp +++ b/src/organizercore.cpp @@ -1264,7 +1264,7 @@ bool OrganizerCore::waitForProcessCompletion(HANDLE handle, LPDWORD exitCode) size_t count = std::min(static_cast(maxCount), numProcesses); if (count > 0) { - for (size_t i = 0; i < count; ++i) { + for (size_t i = 0; i < count && !found; ++i) { std::wstring processName = getProcessName(processes[i]); if (!boost::starts_with(processName, L"ModOrganizer.exe")) { if (!boost::starts_with(processName, L"unknown")) { -- cgit v1.3.1