summaryrefslogtreecommitdiff
path: root/plugins/StatusManager/src/KeepStatus/keepstatus.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-02-02 13:27:14 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-02-02 13:27:14 +0300
commita7a6991d945a508d0f21ab34fd2f76ca15b95248 (patch)
treebf01e4414cea21d2494272d0d150afaae0438fa5 /plugins/StatusManager/src/KeepStatus/keepstatus.cpp
parent7253436a88270d83009626a1a5021658de85e8e8 (diff)
StatusManager:
- fixes #1129 (Status Manager broked. When I change profile - not happend) - all standard memory allocation routines replaced with mir_* (more effective) - classes used to allocate memory instead of manual code
Diffstat (limited to 'plugins/StatusManager/src/KeepStatus/keepstatus.cpp')
-rw-r--r--plugins/StatusManager/src/KeepStatus/keepstatus.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/plugins/StatusManager/src/KeepStatus/keepstatus.cpp b/plugins/StatusManager/src/KeepStatus/keepstatus.cpp
index bbdc6587c7..31e95c3d0b 100644
--- a/plugins/StatusManager/src/KeepStatus/keepstatus.cpp
+++ b/plugins/StatusManager/src/KeepStatus/keepstatus.cpp
@@ -130,14 +130,14 @@ int KSLoadOptions()
static PROTOCOLSETTINGEX** GetCurrentProtoSettingsCopy()
{
mir_cslock lck(GenStatusCS);
- PROTOCOLSETTINGEX **ps = (PROTOCOLSETTINGEX**)malloc(protoList.getCount() * sizeof(PROTOCOLSETTINGEX *));
+ PROTOCOLSETTINGEX **ps = (PROTOCOLSETTINGEX**)mir_alloc(protoList.getCount() * sizeof(PROTOCOLSETTINGEX *));
if (ps == nullptr) {
return nullptr;
}
for (int i = 0; i < protoList.getCount(); i++) {
- ps[i] = (PROTOCOLSETTINGEX*)calloc(1, sizeof(PROTOCOLSETTINGEX));
+ ps[i] = (PROTOCOLSETTINGEX*)mir_calloc(sizeof(PROTOCOLSETTINGEX));
if (ps[i] == nullptr) {
- free(ps);
+ mir_free(ps);
return nullptr;
}
@@ -156,10 +156,10 @@ static void FreeProtoSettings(PROTOCOLSETTINGEX** ps)
{
for (int i = 0; i < protoList.getCount(); i++) {
if (ps[i]->m_szMsg != nullptr)
- free(ps[i]->m_szMsg);
- free(ps[i]);
+ mir_free(ps[i]->m_szMsg);
+ mir_free(ps[i]);
}
- free(ps);
+ mir_free(ps);
}
int SMProto::AssignStatus(int iStatus, int iLastStatus, wchar_t *pwszMsg)
@@ -187,13 +187,13 @@ int SMProto::AssignStatus(int iStatus, int iLastStatus, wchar_t *pwszMsg)
if (pwszMsg != nullptr && mir_wstrcmp(pwszMsg, m_szMsg)) {
if (m_szMsg != nullptr)
- free(m_szMsg);
+ mir_free(m_szMsg);
- m_szMsg = wcsdup(pwszMsg);
+ m_szMsg = mir_wstrdup(pwszMsg);
}
else if (pwszMsg != m_szMsg) {
if (m_szMsg != nullptr)
- free(m_szMsg);
+ mir_free(m_szMsg);
m_szMsg = nullptr;
}