From 0818ec631ca7f0468ed1c0c8e9721033d3867e43 Mon Sep 17 00:00:00 2001 From: kichik Date: Fri, 6 Sep 2002 22:18:47 +0000 Subject: [PATCH] Recompiling caussed memory leaks - fixed git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@950 212acab6-be3b-0410-9dea-997c60f758d6 --- Contrib/Makensisw/makensisw.cpp | 6 ++---- Contrib/Makensisw/utils.cpp | 14 +++++++++----- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/Contrib/Makensisw/makensisw.cpp b/Contrib/Makensisw/makensisw.cpp index fd1820c2..fcf948f9 100644 --- a/Contrib/Makensisw/makensisw.cpp +++ b/Contrib/Makensisw/makensisw.cpp @@ -75,8 +75,6 @@ BOOL CALLBACK DialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { case WM_INITDIALOG: { g_hwnd=hwndDlg; - g_output_exe = (char *)GlobalAlloc(GPTR, 1); - g_input_script = (char *)GlobalAlloc(GPTR, 1); HICON hIcon = LoadIcon(g_hInstance,MAKEINTRESOURCE(IDI_ICON)); SetClassLong(hwndDlg,GCL_HICON,(long)hIcon); HFONT hFont = CreateFont(14,0,0,0,FW_NORMAL,0,0,0,DEFAULT_CHARSET,OUT_CHARACTER_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,FIXED_PITCH|FF_DONTCARE,"Courier New"); @@ -179,14 +177,14 @@ BOOL CALLBACK DialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { case IDM_TEST: case IDC_TEST: { - if (g_output_exe[0]) { + if (g_output_exe) { ShellExecute(g_hwnd,"open",g_output_exe,NULL,NULL,SW_SHOWNORMAL); } return TRUE; } case IDM_EDITSCRIPT: { - if (g_input_script[0]) { + if (g_input_script) { if ((int)ShellExecute(g_hwnd,"open",g_input_script,NULL,NULL,SW_SHOWNORMAL)<=32) { char path[MAX_PATH]; if (GetWindowsDirectory(path,sizeof(path))) { diff --git a/Contrib/Makensisw/utils.cpp b/Contrib/Makensisw/utils.cpp index b765d320..fe03fa0d 100644 --- a/Contrib/Makensisw/utils.cpp +++ b/Contrib/Makensisw/utils.cpp @@ -71,8 +71,6 @@ void ErrorMessage(HWND hwnd,const char *str) { } void DisableItems(HWND hwnd) { - g_output_exe[0]=0; - g_input_script[0]=0; EnableWindow(GetDlgItem(hwnd,IDC_CLOSE),0); EnableWindow(GetDlgItem(hwnd,IDC_TEST),0); HMENU m = GetMenu(hwnd); @@ -90,8 +88,14 @@ void EnableItems(HWND hwnd) { #define MSG1(a,b) SendDlgItemMessage(hwnd,IDC_LOGWIN,a,b,0) #define MSG2(a,b,c) SendDlgItemMessage(hwnd,IDC_LOGWIN,a,b,c) - if (g_input_script) GlobalFree(g_input_script); - if (g_output_exe) GlobalFree(g_output_exe); + if (g_input_script) { + GlobalFree(g_input_script); + g_input_script = 0; + } + if (g_output_exe) { + GlobalFree(g_output_exe); + g_output_exe = 0; + } TEXTRANGE tr; FINDTEXT ft; @@ -124,7 +128,7 @@ void EnableItems(HWND hwnd) { if (MSG2(EM_FINDTEXT, 0, (LPARAM)&ft) != -1) g_warnings++; HMENU m = GetMenu(hwnd); - if (g_output_exe[0]) { + if (g_output_exe) { EnableWindow(GetDlgItem(hwnd,IDC_TEST),1); EnableMenuItem(m,IDM_TEST,MF_ENABLED); }