From: Kevin Wasserman Date: Mon, 21 May 2012 12:12:43 +0000 (-0400) Subject: Add leak tracking support to Leash X-Git-Tag: kfw-4.0-final~100 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=05554fce7293d6a4c9e4bcea2e5f9f3c36ca1f08;p=thirdparty%2Fkrb5.git Add leak tracking support to Leash Signed-off-by: Kevin Wasserman (cherry picked from commit 9d7ce5070d6d5f8390b941cdb617c670f1bf0989) ticket: 7260 status: resolved --- diff --git a/src/windows/leash/Leash.cpp b/src/windows/leash/Leash.cpp index 44e687b31f..27d1db1d77 100644 --- a/src/windows/leash/Leash.cpp +++ b/src/windows/leash/Leash.cpp @@ -127,6 +127,9 @@ CLeashApp::~CLeashApp() AfxFreeLibrary(m_hPsapi); AfxFreeLibrary(m_hToolHelp32); AfxFreeLibrary(m_hKrbLSA); +#ifdef DEBUG + _CrtDumpMemoryLeaks(); +#endif } ///////////////////////////////////////////////////////////////////////////// @@ -158,6 +161,15 @@ extern "C" { BOOL CLeashApp::InitInstance() { +#ifdef DEBUG + _CrtSetReportMode( _CRT_WARN, _CRTDBG_MODE_FILE ); + _CrtSetReportFile( _CRT_WARN, _CRTDBG_FILE_STDOUT ); + _CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_FILE ); + _CrtSetReportFile( _CRT_ERROR, _CRTDBG_FILE_STDOUT ); + + int tmp = _CrtSetDbgFlag( _CRTDBG_REPORT_FLAG); + _CrtSetDbgFlag( tmp | _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); +#endif AfxOleInit(); // NOTE: Not used at this time /// Set LEASH_DLL to the path where the Leash.exe is