mirror of
https://github.com/veracrypt/VeraCrypt
synced 2024-11-30 15:03:31 +01:00
Static Code Analysis : fix various memory leaks.
This commit is contained in:
parent
5281e2d3b9
commit
899a22b840
@ -55,6 +55,8 @@ BOOL CALLBACK CommandHelpDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
|
|||||||
}
|
}
|
||||||
|
|
||||||
SetWindowText (GetDlgItem (hwndDlg, IDC_COMMANDHELP_TEXT), (char*) tmp);
|
SetWindowText (GetDlgItem (hwndDlg, IDC_COMMANDHELP_TEXT), (char*) tmp);
|
||||||
|
|
||||||
|
TCfree(tmp);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6743,7 +6743,11 @@ __int64 FindStringInFile (const char *filePath, const char* str, int strLen)
|
|||||||
|| buffer == NULL
|
|| buffer == NULL
|
||||||
|| strLen > bufSize
|
|| strLen > bufSize
|
||||||
|| strLen < 1)
|
|| strLen < 1)
|
||||||
|
{
|
||||||
|
if (buffer)
|
||||||
|
free (buffer);
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
src = CreateFile (filePath, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
|
src = CreateFile (filePath, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
|
||||||
|
|
||||||
|
@ -7771,7 +7771,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
|
|||||||
|
|
||||||
void ExtractCommandLine (HWND hwndDlg, char *lpszCommandLine)
|
void ExtractCommandLine (HWND hwndDlg, char *lpszCommandLine)
|
||||||
{
|
{
|
||||||
char **lpszCommandLineArgs; /* Array of command line arguments */
|
char **lpszCommandLineArgs = NULL; /* Array of command line arguments */
|
||||||
int nNoCommandLineArgs; /* The number of arguments in the array */
|
int nNoCommandLineArgs; /* The number of arguments in the array */
|
||||||
|
|
||||||
if (_stricmp (lpszCommandLine, "-Embedding") == 0)
|
if (_stricmp (lpszCommandLine, "-Embedding") == 0)
|
||||||
@ -8012,6 +8012,9 @@ void ExtractCommandLine (HWND hwndDlg, char *lpszCommandLine)
|
|||||||
{
|
{
|
||||||
free (lpszCommandLineArgs[nNoCommandLineArgs]);
|
free (lpszCommandLineArgs[nNoCommandLineArgs]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (lpszCommandLineArgs)
|
||||||
|
free (lpszCommandLineArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -8277,7 +8280,7 @@ int ScanVolClusterBitmap (HWND hwndDlg, int *driveNo, __int64 nbrClusters, __int
|
|||||||
if (lpOutBuffer == NULL)
|
if (lpOutBuffer == NULL)
|
||||||
{
|
{
|
||||||
MessageBoxW (hwndDlg, GetString ("ERR_MEM_ALLOC"), lpszTitle, ICON_HAND);
|
MessageBoxW (hwndDlg, GetString ("ERR_MEM_ALLOC"), lpszTitle, ICON_HAND);
|
||||||
goto vcmf_error;
|
goto vcm_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
lpInBuffer.StartingLcn.QuadPart = 0;
|
lpInBuffer.StartingLcn.QuadPart = 0;
|
||||||
@ -8328,7 +8331,7 @@ int ScanVolClusterBitmap (HWND hwndDlg, int *driveNo, __int64 nbrClusters, __int
|
|||||||
|
|
||||||
vcm_error:
|
vcm_error:
|
||||||
CloseHandle (hDevice);
|
CloseHandle (hDevice);
|
||||||
free(lpOutBuffer);
|
if (lpOutBuffer) free(lpOutBuffer);
|
||||||
|
|
||||||
vcmf_error:
|
vcmf_error:
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -6566,7 +6566,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
|
|||||||
|
|
||||||
void ExtractCommandLine (HWND hwndDlg, char *lpszCommandLine)
|
void ExtractCommandLine (HWND hwndDlg, char *lpszCommandLine)
|
||||||
{
|
{
|
||||||
char **lpszCommandLineArgs; /* Array of command line arguments */
|
char **lpszCommandLineArgs = NULL; /* Array of command line arguments */
|
||||||
int nNoCommandLineArgs; /* The number of arguments in the array */
|
int nNoCommandLineArgs; /* The number of arguments in the array */
|
||||||
char tmpPath[MAX_PATH * 2];
|
char tmpPath[MAX_PATH * 2];
|
||||||
|
|
||||||
@ -6842,6 +6842,9 @@ void ExtractCommandLine (HWND hwndDlg, char *lpszCommandLine)
|
|||||||
{
|
{
|
||||||
free (lpszCommandLineArgs[nNoCommandLineArgs]);
|
free (lpszCommandLineArgs[nNoCommandLineArgs]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (lpszCommandLineArgs)
|
||||||
|
free (lpszCommandLineArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user