summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorTobias Weimer <wishmaster51@googlemail.com>2014-12-16 13:11:12 +0000
committerTobias Weimer <wishmaster51@googlemail.com>2014-12-16 13:11:12 +0000
commitea3ab8f3a8ed69436d3350ac15593394fc7e0e56 (patch)
tree57b3c8a186ddea51ad45fb3976a59e0abe90099b /src/core
parent55b2e3d64ab23960caa25fb2a296d44caf39057e (diff)
Fixed minor leaks
git-svn-id: http://svn.miranda-ng.org/main/trunk@11457 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/core')
-rw-r--r--src/core/stdmsg/src/msgdialog.cpp80
-rw-r--r--src/core/stdmsg/src/msglog.cpp2
2 files changed, 40 insertions, 42 deletions
diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp
index 4cb95cbec3..1f2aa4b62f 100644
--- a/src/core/stdmsg/src/msgdialog.cpp
+++ b/src/core/stdmsg/src/msgdialog.cpp
@@ -1096,52 +1096,50 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
case DM_UPDATETITLE:
{
TCHAR newtitle[256];
- if (dat->hContact) {
- if (dat->szProto) {
- int statusIcon = db_get_b(NULL, SRMMMOD, SRMSGSET_STATUSICON, SRMSGDEFSET_STATUSICON);
-
- dat->wStatus = db_get_w(dat->hContact, dat->szProto, "Status", ID_STATUS_OFFLINE);
- TCHAR *contactName = pcli->pfnGetContactDisplayName(dat->hContact, 0);
-
- TCHAR buf[128] = _T("");
- if (strcmp(dat->szProto, META_PROTO)) {
- CONTACTINFO ci = { 0 };
- ci.cbSize = sizeof(ci);
- ci.hContact = dat->hContact;
- ci.szProto = dat->szProto;
- ci.dwFlag = CNF_DISPLAYUID | CNF_TCHAR;
- if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&ci)) {
- switch (ci.type) {
- case CNFT_ASCIIZ:
- _tcsncpy_s(buf, ci.pszVal, _TRUNCATE);
- mir_free(ci.pszVal);
- break;
- case CNFT_DWORD:
- mir_sntprintf(buf, SIZEOF(buf), _T("%u"), ci.dVal);
- break;
- }
+ if (dat->hContact && dat->szProto) {
+ int statusIcon = db_get_b(NULL, SRMMMOD, SRMSGSET_STATUSICON, SRMSGDEFSET_STATUSICON);
+
+ dat->wStatus = db_get_w(dat->hContact, dat->szProto, "Status", ID_STATUS_OFFLINE);
+ TCHAR *contactName = pcli->pfnGetContactDisplayName(dat->hContact, 0);
+
+ TCHAR buf[128] = _T("");
+ if (strcmp(dat->szProto, META_PROTO)) {
+ CONTACTINFO ci = { 0 };
+ ci.cbSize = sizeof(ci);
+ ci.hContact = dat->hContact;
+ ci.szProto = dat->szProto;
+ ci.dwFlag = CNF_DISPLAYUID | CNF_TCHAR;
+ if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&ci)) {
+ switch (ci.type) {
+ case CNFT_ASCIIZ:
+ _tcsncpy_s(buf, ci.pszVal, _TRUNCATE);
+ mir_free(ci.pszVal);
+ break;
+ case CNFT_DWORD:
+ mir_sntprintf(buf, SIZEOF(buf), _T("%u"), ci.dVal);
+ break;
}
}
- if (buf[0])
- SetDlgItemText(hwndDlg, IDC_NAME, buf);
- else
- SetDlgItemText(hwndDlg, IDC_NAME, contactName);
+ }
+ if (buf[0])
+ SetDlgItemText(hwndDlg, IDC_NAME, buf);
+ else
+ SetDlgItemText(hwndDlg, IDC_NAME, contactName);
- TCHAR *szStatus = pcli->pfnGetStatusModeDescription(dat->szProto == NULL ? ID_STATUS_OFFLINE : db_get_w(dat->hContact, dat->szProto, "Status", ID_STATUS_OFFLINE), 0);
- if (statusIcon)
- mir_sntprintf(newtitle, SIZEOF(newtitle), _T("%s - %s"), contactName, TranslateT("Message session"));
- else
- mir_sntprintf(newtitle, SIZEOF(newtitle), _T("%s (%s): %s"), contactName, szStatus, TranslateT("Message session"));
+ TCHAR *szStatus = pcli->pfnGetStatusModeDescription(dat->szProto == NULL ? ID_STATUS_OFFLINE : db_get_w(dat->hContact, dat->szProto, "Status", ID_STATUS_OFFLINE), 0);
+ if (statusIcon)
+ mir_sntprintf(newtitle, SIZEOF(newtitle), _T("%s - %s"), contactName, TranslateT("Message session"));
+ else
+ mir_sntprintf(newtitle, SIZEOF(newtitle), _T("%s (%s): %s"), contactName, szStatus, TranslateT("Message session"));
- DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *)wParam;
- if (!cws || (!strcmp(cws->szModule, dat->szProto) && !strcmp(cws->szSetting, "Status"))) {
- InvalidateRect(GetDlgItem(hwndDlg, IDC_PROTOCOL), NULL, TRUE);
- if (statusIcon)
- SendMessage(hwndDlg, DM_UPDATEWINICON, 0, 0);
- }
-
- dat->wOldStatus = dat->wStatus;
+ DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *)wParam;
+ if (!cws || (!strcmp(cws->szModule, dat->szProto) && !strcmp(cws->szSetting, "Status"))) {
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_PROTOCOL), NULL, TRUE);
+ if (statusIcon)
+ SendMessage(hwndDlg, DM_UPDATEWINICON, 0, 0);
}
+
+ dat->wOldStatus = dat->wStatus;
}
else
mir_tstrncpy(newtitle, TranslateT("Message session"), SIZEOF(newtitle));
diff --git a/src/core/stdmsg/src/msglog.cpp b/src/core/stdmsg/src/msglog.cpp
index 730d0610d1..e5d71acd7d 100644
--- a/src/core/stdmsg/src/msglog.cpp
+++ b/src/core/stdmsg/src/msglog.cpp
@@ -314,7 +314,7 @@ static char *CreateRTFFromDbEvent(SrmmWindowData *dat, MCONTACT hContact, HANDLE
}
else
// Shouldn't happen?
- szName = TranslateT("Me");
+ szName = mir_tstrdup(TranslateT("Me"));
}
else szName = pcli->pfnGetContactDisplayName(hContact, 0);