From daf3e389b479f28b306e7c88ecc49119f0bbf542 Mon Sep 17 00:00:00 2001 From: Alexander Gluzsky Date: Wed, 31 Jul 2013 23:16:34 +0000 Subject: fixed few logic bugs fixed few memory leaks prevent db helper functions from returning uninitialized ptr git-svn-id: http://svn.miranda-ng.org/main/trunk@5542 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/New_GPG/src/main.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) mode change 100644 => 100755 plugins/New_GPG/src/main.cpp (limited to 'plugins/New_GPG/src/main.cpp') diff --git a/plugins/New_GPG/src/main.cpp b/plugins/New_GPG/src/main.cpp old mode 100644 new mode 100755 index 41d568f8fa..39879537c1 --- a/plugins/New_GPG/src/main.cpp +++ b/plugins/New_GPG/src/main.cpp @@ -233,6 +233,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR accs += accounts[i]->tszAccountName; } } + mir_free(str); } ListView_SetItemText(hwndList, iRow, 6, (TCHAR*)accs.c_str()); } @@ -891,7 +892,8 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, if(!boost::filesystem::exists(tmp)) MessageBox(0, TranslateT("wrong gpg binary location found in system.\nplease choose another location"), TranslateT("Warning"), MB_OK); } - else tmp = mir_wstrdup(path); + else + tmp = mir_wstrdup(path); mir_free(path); SetDlgItemText(hwndDlg, IDC_BIN_PATH, tmp); @@ -2125,7 +2127,7 @@ void InitCheck() PROTOACCOUNT **accounts; ProtoEnumAccounts(&count, &accounts); string question; - char *keyid, *key; + char *keyid = nullptr, *key = nullptr; for(int i = 0; i < count; i++) { if(StriStr(accounts[i]->szModuleName, "metacontacts")) @@ -2141,6 +2143,7 @@ void InitCheck() if(keyid[0]) { question = Translate("Your secret key whith id: "); + mir_free(keyid); keyid = UniGetContactSettingUtf(NULL, szGPGModuleName, "KeyID", ""); key = UniGetContactSettingUtf(NULL, szGPGModuleName, "GPGPubKey", ""); void ShowFirstRunDialog(); @@ -2198,7 +2201,11 @@ void InitCheck() mir_free(expire_date); } } - mir_free(keyid); + if(keyid) + { + mir_free(keyid); + keyid = nullptr; + } } question = Translate("Your secret key whith id: "); keyid = UniGetContactSettingUtf(NULL, szGPGModuleName, "KeyID", ""); -- cgit v1.2.3