diff options
author | Tobias Weimer <wishmaster51@googlemail.com> | 2015-01-22 19:51:34 +0000 |
---|---|---|
committer | Tobias Weimer <wishmaster51@googlemail.com> | 2015-01-22 19:51:34 +0000 |
commit | 5e1548f7902322e8efe75c390c64c6b958c43b2d (patch) | |
tree | 65ab9d39bbf13597c6aa6d3a5348cd7752ce32dc /plugins/Watrack_MPD/src | |
parent | 5a168e085110bb7458b70e8b9a0075f161b40166 (diff) |
WATrack_MPD:
- Fixed memory leaks
git-svn-id: http://svn.miranda-ng.org/main/trunk@11894 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Watrack_MPD/src')
-rwxr-xr-x | plugins/Watrack_MPD/src/init.cpp | 6 | ||||
-rwxr-xr-x | plugins/Watrack_MPD/src/main.cpp | 2 | ||||
-rwxr-xr-x | plugins/Watrack_MPD/src/utilities.cpp | 12 |
3 files changed, 5 insertions, 15 deletions
diff --git a/plugins/Watrack_MPD/src/init.cpp b/plugins/Watrack_MPD/src/init.cpp index 3a1b47de37..2d50447cdd 100755 --- a/plugins/Watrack_MPD/src/init.cpp +++ b/plugins/Watrack_MPD/src/init.cpp @@ -51,8 +51,6 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda void InitVars()
{
gbPort = db_get_w(NULL, szModuleName, "Port", 6600);
- gbPassword = (TCHAR*)malloc(64*sizeof(TCHAR));
- gbHost = (TCHAR*)malloc(128*sizeof(TCHAR));
gbHost = UniGetContactSettingUtf(NULL, szModuleName, "Server", _T("127.0.0.1"));
gbPassword = UniGetContactSettingUtf(NULL, szModuleName, "Password", _T(""));
}
@@ -84,7 +82,7 @@ extern "C" __declspec(dllexport) int Load() extern "C" __declspec(dllexport) int Unload(void)
{
- free(gbHost);
- free(gbPassword);
+ mir_free(gbHost);
+ mir_free(gbPassword);
return 0;
}
diff --git a/plugins/Watrack_MPD/src/main.cpp b/plugins/Watrack_MPD/src/main.cpp index 85c595be9b..00063245b9 100755 --- a/plugins/Watrack_MPD/src/main.cpp +++ b/plugins/Watrack_MPD/src/main.cpp @@ -123,7 +123,7 @@ int Parser() for(i = 0; ((ptr[i] != '\n') && (ptr[i] != '\0')); i++) tmp[i] = ptr[i]; tmp[i] = '\0'; - strcpy(ver, tmp); + strncpy_s(ver, tmp, _TRUNCATE); SongInfo.txtver = mir_utf8decodeT(tmp); } else diff --git a/plugins/Watrack_MPD/src/utilities.cpp b/plugins/Watrack_MPD/src/utilities.cpp index 8ff7a65624..1375cc2bc1 100755 --- a/plugins/Watrack_MPD/src/utilities.cpp +++ b/plugins/Watrack_MPD/src/utilities.cpp @@ -19,14 +19,6 @@ TCHAR* __stdcall UniGetContactSettingUtf(MCONTACT hContact, const char *szModule,const char* szSetting, TCHAR* szDef) { - DBVARIANT dbv = {DBVT_DELETED}; - TCHAR* szRes = NULL; - if (db_get_ts(hContact, szModule, szSetting, &dbv)) - return _tcsdup(szDef); - else if(dbv.pszVal) - szRes = _tcsdup(dbv.ptszVal); - else - szRes = _tcsdup(szDef); - db_free(&dbv); - return szRes; + TCHAR *szRes = db_get_tsa(hContact, szModule, szSetting); + return szRes ? szRes : mir_tstrdup(szDef); } |