aboutsummaryrefslogtreecommitdiff
path: root/src/common/Debugging/WheatyExceptionReport.cpp
diff options
context:
space:
mode:
authorjackpoz <giacomopoz@gmail.com>2017-07-16 18:16:48 +0200
committerjackpoz <giacomopoz@gmail.com>2017-07-16 18:20:29 +0200
commit9cf4dd7345b7f05db834fd48a9f0a135f1884d70 (patch)
tree55067acd31a0cdd14d23f040a3ac77dd6fbd4f00 /src/common/Debugging/WheatyExceptionReport.cpp
parentf44956b051030f57378489b8c82517919d59955e (diff)
Core/Misc: Fix static analysis issues
Diffstat (limited to 'src/common/Debugging/WheatyExceptionReport.cpp')
-rw-r--r--src/common/Debugging/WheatyExceptionReport.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/common/Debugging/WheatyExceptionReport.cpp b/src/common/Debugging/WheatyExceptionReport.cpp
index 5b6e9e76ebc..8211f4d6151 100644
--- a/src/common/Debugging/WheatyExceptionReport.cpp
+++ b/src/common/Debugging/WheatyExceptionReport.cpp
@@ -126,7 +126,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)
@@ -1385,12 +1385,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;
}