summaryrefslogtreecommitdiff
path: root/plugins/NewXstatusNotify/src/xstatus.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-07-31 18:37:01 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-07-31 18:37:01 +0000
commit4b25736d4b3565e4e9945d191d15e0740dce6afc (patch)
treef047bb7f5dfbb7c5ad0cf1dbe8bef7618d294f14 /plugins/NewXstatusNotify/src/xstatus.cpp
parent9631bfe941ed0cbba6e720b7efd92966e0c6a670 (diff)
various memory allocation problems fixed
git-svn-id: http://svn.miranda-ng.org/main/trunk@10006 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/NewXstatusNotify/src/xstatus.cpp')
-rw-r--r--plugins/NewXstatusNotify/src/xstatus.cpp32
1 files changed, 5 insertions, 27 deletions
diff --git a/plugins/NewXstatusNotify/src/xstatus.cpp b/plugins/NewXstatusNotify/src/xstatus.cpp
index 366a750dc8..7ca0ed3879 100644
--- a/plugins/NewXstatusNotify/src/xstatus.cpp
+++ b/plugins/NewXstatusNotify/src/xstatus.cpp
@@ -37,7 +37,6 @@ void FreeXSC(XSTATUSCHANGE *xsc)
mir_free(xsc->stzTitle);
mir_free(xsc->stzText);
mir_free(xsc);
- xsc = NULL;
}
}
@@ -236,8 +235,7 @@ void ShowXStatusPopup(XSTATUSCHANGE *xsc)
if (copyText) {
mir_free(xsc->stzText);
- xsc->stzText = mir_tstrdup(copyText);
- mir_free(copyText);
+ xsc->stzText = copyText;
}
}
@@ -263,10 +261,8 @@ void BlinkXStatusIcon(XSTATUSCHANGE *xsc)
}
break;
case TYPE_ICQ_XSTATUS:
- {
- int statusId = db_get_b(xsc->hContact, xsc->szProto, "XStatusId", 0);
- hIcon = (HICON)CallProtoService(xsc->szProto, PS_GETCUSTOMSTATUSICON, statusId, LR_SHARED);
- }
+ int statusId = db_get_b(xsc->hContact, xsc->szProto, "XStatusId", 0);
+ hIcon = (HICON)CallProtoService(xsc->szProto, PS_GETCUSTOMSTATUSICON, statusId, LR_SHARED);
}
}
@@ -534,32 +530,14 @@ void AddXStatusEventThread(void *arg)
void AddSMsgEventThread(void *arg)
{
MCONTACT hContact = (MCONTACT)arg;
- STATUSMSGINFO smi;
+ STATUSMSGINFO smi;
smi.hContact = hContact;
smi.proto = GetContactProto(hContact);
if (smi.proto == NULL)
return;
- DBVARIANT dbv;
- if (!db_get_s(smi.hContact, "CList", "StatusMsg", &dbv, 0)) {
- switch (dbv.type) {
- case DBVT_ASCIIZ:
- smi.newstatusmsg = mir_dupToUnicodeEx(dbv.pszVal, CP_ACP);
- break;
- case DBVT_UTF8:
- smi.newstatusmsg = mir_dupToUnicodeEx(dbv.pszVal, CP_UTF8);
- break;
- case DBVT_WCHAR:
- smi.newstatusmsg = mir_wstrdup(dbv.pwszVal);
- break;
- default:
- smi.newstatusmsg = NULL;
- break;
- }
- db_free(&dbv);
- }
-
+ smi.newstatusmsg = db_get_tsa(smi.hContact, "CList", "StatusMsg");
LogSMsgToDB(&smi, templates.LogSMsgOpening);
mir_free(smi.newstatusmsg);
}