https://git.reactos.org/?p=reactos.git;a=commitdiff;h=5cf947edc771b0831bc9f…
commit 5cf947edc771b0831bc9f007fcb5936bcebfce26
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Tue Mar 14 07:22:34 2023 +0900
Commit: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
CommitDate: Tue Mar 14 07:22:34 2023 +0900
[REGEDIT] Use _CrtSetDbgFlag to check memory leak
We can borrow the power of CRT debug. These changes are effective for debug version
only:
- Insert #include <crtdbg.h> at main.c.
- Call _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF) at the prologue of
wWinMain.
This is a follow-up of #5151 (9abd9b6) and 0998665.
---
base/applications/regedit/main.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/base/applications/regedit/main.c b/base/applications/regedit/main.c
index c762d6521dd..5ec8ddca2cc 100644
--- a/base/applications/regedit/main.c
+++ b/base/applications/regedit/main.c
@@ -20,6 +20,10 @@
#include "regedit.h"
+#ifdef _DEBUG
+#include <crtdbg.h>
+#endif
+
BOOL ProcessCmdLine(WCHAR *cmdline);
const WCHAR *reg_class_namesW[] = {L"HKEY_LOCAL_MACHINE",
L"HKEY_USERS",
@@ -205,6 +209,11 @@ int WINAPI wWinMain(HINSTANCE hInstance,
UNREFERENCED_PARAMETER(hPrevInstance);
+#ifdef _DEBUG
+ /* Report any memory leaks on exit */
+ _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
+#endif
+
/* Initialize global strings */
LoadStringW(hInstance, IDS_APP_TITLE, szTitle, ARRAY_SIZE(szTitle));
LoadStringW(hInstance, IDC_REGEDIT_FRAME, szFrameClass, ARRAY_SIZE(szFrameClass));