[core] fix a memory leak when search for process is interrupted

This commit is contained in:
Pete Batard 2019-04-10 12:17:47 +01:00
parent d4a663991b
commit 38d82612cd
No known key found for this signature in database
GPG key ID: 38E0CF5E69EDD671
4 changed files with 24 additions and 22 deletions

View file

@ -1788,7 +1788,7 @@ static void SaveISO(void)
// dwTimeOut is the maximum amount of time we allow for this call to execute (in ms)
// If bPrompt is false, the return value is the amount of time remaining before
// dwTimeOut would expire (or zero if we spent more than dwTimeout in this procedure).
// If bPrompt is true, the return value is 0 on error, non-zero on success.
// If bPrompt is true, the return value is 0 on error, dwTimeOut on success.
DWORD CheckDriveAccess(DWORD dwTimeOut, BOOL bPrompt)
{
uint32_t i, j;
@ -1848,7 +1848,7 @@ DWORD CheckDriveAccess(DWORD dwTimeOut, BOOL bPrompt)
proceed = Notification(MSG_WARNING_QUESTION, NULL, NULL, title, lmprintf(MSG_132));
}
if (bPrompt) {
ret = (DWORD)proceed;
ret = proceed ? dwTimeOut : 0;
} else {
ret = (DWORD)(GetTickCount64() - start_time);
ret = (dwTimeOut > ret) ? (dwTimeOut - ret) : 0;