summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-10-24 09:39:28 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-10-24 09:39:28 +0000
commit9745bbeb5bf5b8fc4b944c2400cf0ec295c2e0e0 (patch)
treeac6300eb60251a9ba033f37b71398ad0a32b8e17
parent1bc4676dee59e19949dd2ea8ec68d8e587d1ab5f (diff)
double memory allocation removed
git-svn-id: http://svn.miranda-ng.org/main/trunk@10859 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--src/mir_core/db.cpp24
1 files changed, 10 insertions, 14 deletions
diff --git a/src/mir_core/db.cpp b/src/mir_core/db.cpp
index 9fc57870ad..079225682a 100644
--- a/src/mir_core/db.cpp
+++ b/src/mir_core/db.cpp
@@ -99,24 +99,20 @@ MIR_CORE_DLL(INT_PTR) db_get_s(MCONTACT hContact, const char *szModule, const ch
MIR_CORE_DLL(char*) db_get_sa(MCONTACT hContact, const char *szModule, const char *szSetting)
{
- char *str = NULL;
- DBVARIANT dbv = {0};
- db_get_s(hContact, szModule, szSetting, &dbv, DBVT_ASCIIZ);
- if (dbv.type == DBVT_ASCIIZ)
- str = mir_strdup(dbv.pszVal);
- db_free(&dbv);
- return str;
+ if (currDb == NULL)
+ return NULL;
+
+ DBVARIANT dbv = { DBVT_ASCIIZ };
+ return currDb->GetContactSettingStr(hContact, szModule, szSetting, &dbv) ? NULL : dbv.pszVal;
}
MIR_CORE_DLL(wchar_t*) db_get_wsa(MCONTACT hContact, const char *szModule, const char *szSetting)
{
- wchar_t *str = NULL;
- DBVARIANT dbv={0};
- db_get_s(hContact, szModule, szSetting, &dbv, DBVT_WCHAR);
- if (dbv.type == DBVT_WCHAR)
- str = mir_wstrdup(dbv.pwszVal);
- db_free(&dbv);
- return str;
+ if (currDb == NULL)
+ return NULL;
+
+ DBVARIANT dbv = { DBVT_WCHAR };
+ return currDb->GetContactSettingStr(hContact, szModule, szSetting, &dbv) ? NULL : dbv.pwszVal;
}
/////////////////////////////////////////////////////////////////////////////////////////