]> git.ipfire.org Git - thirdparty/krb5.git/commitdiff
Add leak tracking support to Leash
authorKevin Wasserman <kevin.wasserman@painless-security.com>
Mon, 21 May 2012 12:12:43 +0000 (08:12 -0400)
committerTom Yu <tlyu@mit.edu>
Mon, 27 Aug 2012 23:27:34 +0000 (19:27 -0400)
Signed-off-by: Kevin Wasserman <kevin.wasserman@painless-security.com>
(cherry picked from commit 9d7ce5070d6d5f8390b941cdb617c670f1bf0989)

ticket: 7260
status: resolved

src/windows/leash/Leash.cpp

index 44e687b31f86e37aeff23fe56fa596a1d2c4a340..27d1db1d77e5e4e4e8f9cc428603fcd971fc848b 100644 (file)
@@ -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