Fixed resource leak in make_minidump() when returning without calling FreeLibrary() on variable 'hDbgHelp'

This commit is contained in:
RElesgoe 2016-08-23 23:38:10 -07:00
parent 21402786df
commit 44cb120a8d

View file

@ -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();