Core/Misc: Fix static analysis issues

This commit is contained in:
Aokromes
2017-07-16 19:05:26 +02:00
parent e4841c960b
commit 8b6261c809
12 changed files with 24 additions and 37 deletions

View File

@@ -123,7 +123,7 @@ PEXCEPTION_POINTERS pExceptionInfo)
++pos;
TCHAR crash_folder_path[MAX_PATH];
sprintf(crash_folder_path, "%s\\%s", module_folder_name, CrashFolder);
sprintf_s(crash_folder_path, "%s\\%s", module_folder_name, CrashFolder);
if (!CreateDirectory(crash_folder_path, NULL))
{
if (GetLastError() != ERROR_ALREADY_EXISTS)
@@ -1382,12 +1382,15 @@ int __cdecl WheatyExceptionReport::StackLog(const TCHAR * format, va_list argptr
int __cdecl WheatyExceptionReport::HeapLog(const TCHAR * format, va_list argptr)
{
int retValue;
int retValue = 0;
DWORD cbWritten;
TCHAR* szBuff = (TCHAR*)malloc(sizeof(TCHAR) * WER_LARGE_BUFFER_SIZE);
retValue = vsprintf(szBuff, format, argptr);
WriteFile(m_hReportFile, szBuff, retValue * sizeof(TCHAR), &cbWritten, 0);
free(szBuff);
if (szBuff != nullptr)
{
retValue = vsprintf(szBuff, format, argptr);
WriteFile(m_hReportFile, szBuff, retValue * sizeof(TCHAR), &cbWritten, 0);
free(szBuff);
}
return retValue;
}