diff options
author | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2014-07-09 05:32:14 +0200 |
---|---|---|
committer | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2014-11-08 23:20:40 +0100 |
commit | 5281e2d3b9adea8dff1730d78fe94af85582aea8 (patch) | |
tree | eaf094f9e339ff1809e2c18bb3e37e88450c6184 /src/Mount/Mount.c | |
parent | 2a288a7e127d37962fa0ec3659d73d8f33bfdc63 (diff) | |
download | VeraCrypt-5281e2d3b9adea8dff1730d78fe94af85582aea8.tar.gz VeraCrypt-5281e2d3b9adea8dff1730d78fe94af85582aea8.zip |
Static Code Analysis : fix resource leakage by ensuring that all Windows handles are released properly
Diffstat (limited to 'src/Mount/Mount.c')
-rw-r--r-- | src/Mount/Mount.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/src/Mount/Mount.c b/src/Mount/Mount.c index 370c5f57..eee282a8 100644 --- a/src/Mount/Mount.c +++ b/src/Mount/Mount.c @@ -7001,7 +7001,11 @@ BOOL TaskBarIconAdd (HWND hwnd) TaskBarIconMutex = CreateMutex (NULL, TRUE, "VeraCryptTaskBarIcon");
if (TaskBarIconMutex == NULL || GetLastError () == ERROR_ALREADY_EXISTS)
{
- TaskBarIconMutex = NULL;
+ if (TaskBarIconMutex)
+ {
+ CloseHandle(TaskBarIconMutex);
+ TaskBarIconMutex = NULL;
+ }
return FALSE;
}
@@ -8692,7 +8696,12 @@ void AnalyzeKernelMiniDump (HWND hwndDlg) NormalCursor();
DWORD exitCode;
- if (!GetExitCodeProcess (procInfo.hProcess, &exitCode) || exitCode != 0)
+ bool bExitCheck = (!GetExitCodeProcess (procInfo.hProcess, &exitCode) || exitCode != 0);
+
+ CloseHandle(procInfo.hProcess);
+ CloseHandle(procInfo.hThread);
+
+ if (bExitCheck)
return;
}
@@ -8764,6 +8773,10 @@ void AnalyzeKernelMiniDump (HWND hwndDlg) {
handleWin32Error (hwndDlg);
Error ("DEBUGGER_NOT_FOUND");
+ CloseHandle (procInfo.hProcess);
+ CloseHandle (procInfo.hThread);
+ CloseHandle (hChildStdoutRead);
+ CloseHandle (hChildStdoutWrite);
return;
}
@@ -8787,6 +8800,8 @@ void AnalyzeKernelMiniDump (HWND hwndDlg) output.insert (output.size(), pipeBuffer, bytesReceived);
}
+ CloseHandle (hChildStdoutRead);
+
NormalCursor();
bool otherDriver = (StringToUpperCase (output).find (StringToUpperCase (TC_APP_NAME)) == string::npos);
@@ -8868,7 +8883,7 @@ void AnalyzeKernelMiniDump (HWND hwndDlg) retAddrs.push_back (s);
}
- /*
+/*
char url[MAX_URL_LENGTH];
sprintf (url, TC_APPLINK_SECURE "&dest=syserr-report&os=%s&osver=%d.%d.%d&arch=%s&err=%I64x&arg1=%I64x&arg2=%I64x&arg3=%I64x&arg4=%I64x&flag=%s&drv=%s",
GetWindowsEdition().c_str(),
@@ -8943,7 +8958,7 @@ void AnalyzeKernelMiniDump (HWND hwndDlg) if (AskYesNoString (msg.c_str()) == IDYES)
ShellExecute (NULL, "open", urlStr.c_str(), NULL, NULL, SW_SHOWNORMAL);
- */
+*/
}
|