Fixed resource leak in make_minidump() when returning without calling FreeLibrary() on variable 'hDbgHelp'
This commit is contained in:
parent
21402786df
commit
44cb120a8d
1 changed files with 6 additions and 0 deletions
|
@ -883,7 +883,10 @@ void make_minidump(EXCEPTION_POINTERS* e)
|
|||
|
||||
auto pMiniDumpWriteDump = reinterpret_cast<decltype(&MiniDumpWriteDump)>(GetProcAddress(hDbgHelp, "MiniDumpWriteDump"));
|
||||
if (pMiniDumpWriteDump == nullptr)
|
||||
{
|
||||
FreeLibrary(hDbgHelp);
|
||||
return;
|
||||
}
|
||||
|
||||
wchar_t name[MAX_PATH] = {};
|
||||
{
|
||||
|
@ -895,7 +898,10 @@ void make_minidump(EXCEPTION_POINTERS* e)
|
|||
|
||||
auto hFile = CreateFileW(name, GENERIC_WRITE, FILE_SHARE_READ, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
|
||||
if (hFile == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
FreeLibrary(hDbgHelp);
|
||||
return;
|
||||
}
|
||||
|
||||
MINIDUMP_EXCEPTION_INFORMATION exceptionInfo = {};
|
||||
exceptionInfo.ThreadId = GetCurrentThreadId();
|
||||
|
|
Loading…
Reference in a new issue