]> 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)
committerBen Kaduk <kaduk@mit.edu>
Fri, 24 Aug 2012 19:53:37 +0000 (15:53 -0400)
Signed-off-by: Kevin Wasserman <kevin.wasserman@painless-security.com>
ticket: 7260 (new)
queue: kfw
target_version: 1.10.4
tags: pullup

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