From bdef5db62ca9fb2a86bf7d1145e7f63f89acd43e Mon Sep 17 00:00:00 2001 From: Simon Rozman Date: Wed, 18 May 2016 09:07:41 +0200 Subject: [PATCH] Memory-leak detection added --- CredWrite/Main.cpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/CredWrite/Main.cpp b/CredWrite/Main.cpp index f804109..6c30217 100644 --- a/CredWrite/Main.cpp +++ b/CredWrite/Main.cpp @@ -24,13 +24,8 @@ using namespace std; using namespace winstd; -int CALLBACK WinMain(_In_ HINSTANCE hInstance, _In_ HINSTANCE hPrevInstance, _In_ LPSTR lpCmdLine, _In_ int nCmdShow) +static int CredWrite() { - UNREFERENCED_PARAMETER(hInstance); - UNREFERENCED_PARAMETER(hPrevInstance); - UNREFERENCED_PARAMETER(lpCmdLine); - UNREFERENCED_PARAMETER(nCmdShow); - int nArgs; unique_ptr > pwcArglist(CommandLineToArgvW(GetCommandLineW(), &nArgs)); if (pwcArglist == NULL) { @@ -104,3 +99,16 @@ int CALLBACK WinMain(_In_ HINSTANCE hInstance, _In_ HINSTANCE hPrevInstance, _In return 0; } + +int CALLBACK WinMain(_In_ HINSTANCE hInstance, _In_ HINSTANCE hPrevInstance, _In_ LPSTR lpCmdLine, _In_ int nCmdShow) +{ + UNREFERENCED_PARAMETER(hInstance); + UNREFERENCED_PARAMETER(hPrevInstance); + UNREFERENCED_PARAMETER(lpCmdLine); + UNREFERENCED_PARAMETER(nCmdShow); + + int res = CredWrite(); + assert(!_CrtDumpMemoryLeaks()); + return res; +} +