diff options
author | Alexander Gluzsky <sss123next@list.ru> | 2013-07-31 23:16:36 +0000 |
---|---|---|
committer | Alexander Gluzsky <sss123next@list.ru> | 2013-07-31 23:16:36 +0000 |
commit | e01bfe30d2bde2ad9f6fbf8a0295c9916ee1cd55 (patch) | |
tree | b3fe499c25e04a5610030b94cc1bc68bb4845b5d /plugins/Watrack_MPD | |
parent | daf3e389b479f28b306e7c88ecc49119f0bbf542 (diff) |
fixed few memory leaks
prevent db helper functions from returning uninitialized ptr
git-svn-id: http://svn.miranda-ng.org/main/trunk@5543 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Watrack_MPD')
-rwxr-xr-x | plugins/Watrack_MPD/src/options.cpp | 8 | ||||
-rwxr-xr-x | plugins/Watrack_MPD/src/utilities.cpp | 6 |
2 files changed, 10 insertions, 4 deletions
diff --git a/plugins/Watrack_MPD/src/options.cpp b/plugins/Watrack_MPD/src/options.cpp index 9d9d755f8c..a3cc00d498 100755 --- a/plugins/Watrack_MPD/src/options.cpp +++ b/plugins/Watrack_MPD/src/options.cpp @@ -24,8 +24,12 @@ static INT_PTR CALLBACK DlgProcWaMpdOpts(HWND hwndDlg, UINT msg, WPARAM wParam, { TranslateDialogDefault(hwndDlg); SetDlgItemInt(hwndDlg, IDC_PORT, db_get_w(NULL, szModuleName, "Port", 6600), FALSE); - SetDlgItemText(hwndDlg, IDC_SERVER, UniGetContactSettingUtf(NULL, szModuleName, "Server", _T("127.0.0.1"))); - SetDlgItemText(hwndDlg, IDC_PASSWORD, UniGetContactSettingUtf(NULL, szModuleName, "Password", _T(""))); + TCHAR *tmp = UniGetContactSettingUtf(NULL, szModuleName, "Server", _T("127.0.0.1")); + SetDlgItemText(hwndDlg, IDC_SERVER, tmp); + mir_free(tmp); + tmp = UniGetContactSettingUtf(NULL, szModuleName, "Password", _T("")); + SetDlgItemText(hwndDlg, IDC_PASSWORD, tmp); + mir_free(tmp); return TRUE; } diff --git a/plugins/Watrack_MPD/src/utilities.cpp b/plugins/Watrack_MPD/src/utilities.cpp index fc5e621837..05c5d2f1b4 100755 --- a/plugins/Watrack_MPD/src/utilities.cpp +++ b/plugins/Watrack_MPD/src/utilities.cpp @@ -20,11 +20,13 @@ TCHAR* __stdcall UniGetContactSettingUtf(HANDLE hContact, const char *szModule,const char* szSetting, TCHAR* szDef) { DBVARIANT dbv = {DBVT_DELETED}; - TCHAR* szRes; + TCHAR* szRes = NULL; if (db_get_ts(hContact, szModule, szSetting, &dbv)) return _tcsdup(szDef); - if(dbv.pszVal) + else if(dbv.pszVal) szRes = _tcsdup(dbv.ptszVal); + else + szRes = _tcsdup(szDef); db_free(&dbv); return szRes; } |