From acb5b8f9c8e9d808391a0214e645712b03c8810b Mon Sep 17 00:00:00 2001 From: Selva Nair Date: Mon, 23 Jan 2023 18:54:51 -0500 Subject: [PATCH] Fix a handle leak: close registry key in localization.c - Also call Kill the IDT_STOP_TIMER in StatusDialogFunc. Though timers will get destroyed during Window destruction an explicit KillTimer in case still running is the "right" thing to do. Signed-off-by: Selva Nair --- localization.c | 3 +++ openvpn.c | 1 + 2 files changed, 4 insertions(+) diff --git a/localization.c b/localization.c index 9714d6e..8db12ae 100644 --- a/localization.c +++ b/localization.c @@ -97,7 +97,10 @@ GetGUILanguage(void) LONG status = RegOpenKeyEx(HKEY_CURRENT_USER, GUI_REGKEY_HKCU, 0, KEY_READ, ®key); if (status == ERROR_SUCCESS) + { GetRegistryValueNumeric(regkey, _T("ui_language"), &value); + RegCloseKey(regkey); + } gui_language = ( value != 0 ? value : GetUserDefaultUILanguage() ); InitMUILanguage(gui_language); diff --git a/openvpn.c b/openvpn.c index 2ee1427..6379a8d 100644 --- a/openvpn.c +++ b/openvpn.c @@ -2078,6 +2078,7 @@ StatusDialogFunc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) return TRUE; case WM_NCDESTROY: + KillTimer(hwndDlg, IDT_STOP_TIMER); RemoveProp(hwndDlg, cfgProp); break;