From ce0d35aaa003e891027bbece4339107eb9e146ed Mon Sep 17 00:00:00 2001 From: MikalaiR Date: Mon, 13 Jul 2015 19:35:57 +0000 Subject: SkypeWeb: memleaks fix. git-svn-id: http://svn.miranda-ng.org/main/trunk@14553 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/SkypeWeb/src/skype_events.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'protocols/SkypeWeb/src') diff --git a/protocols/SkypeWeb/src/skype_events.cpp b/protocols/SkypeWeb/src/skype_events.cpp index 99dd4a2b5e..64cf955faf 100644 --- a/protocols/SkypeWeb/src/skype_events.cpp +++ b/protocols/SkypeWeb/src/skype_events.cpp @@ -67,14 +67,18 @@ INT_PTR CSkypeProto::GetCallEventText(WPARAM, LPARAM lParam) HXML xmlNode = xmlGetNthChild(xml, _T("file"), i); if (xmlNode != NULL) { - fileSize = _ttoi(xmlGetAttrValue(xmlNode, _T("size"))); + fileSize = _ttoi(ptrT((TCHAR*)xmlGetAttrValue(xmlNode, _T("size")))); ptrA fileName(mir_utf8encodeT(xmlGetText(xmlNode))); - if (fileName == NULL || fileSize == NULL) - continue; - CMStringA msg(FORMAT, "%s:\n\t%s: %s\n\t%s: %d %s", Translate("File transfer"), Translate("File name"), fileName, Translate("Size"), fileSize, Translate("bytes")); - text.AppendFormat("%s\n", msg); + if (fileName != NULL) + { + CMStringA msg(FORMAT, "%s:\n\t%s: %s\n\t%s: %d %s", Translate("File transfer"), Translate("File name"), fileName, Translate("Size"), fileSize, Translate("bytes")); + text.AppendFormat("%s\n", msg); + } + + xmlDestroyNode(xmlNode); } } + xmlDestroyNode(xml); } pszText = mir_strdup(text.GetBuffer()); break; @@ -86,6 +90,7 @@ INT_PTR CSkypeProto::GetCallEventText(WPARAM, LPARAM lParam) if (xml != NULL) { text.Append(mir_t2a(xmlGetText(xml))); + xmlDestroyNode(xml); } pszText = mir_strdup(text.GetBuffer()); break; @@ -108,7 +113,6 @@ INT_PTR CSkypeProto::GetCallEventText(WPARAM, LPARAM lParam) TCHAR *pwszText = _A2T(pszText); nRetVal = (INT_PTR)mir_tstrdup(pwszText); } - else if (pEvent->datatype == DBVT_ASCIIZ) nRetVal = (INT_PTR)mir_strdup(pszText); -- cgit v1.2.3