From fe2c3dda8f60afa17a18f3f687b9d5eb04ed5d07 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 12 Jun 2013 19:05:01 +0000 Subject: Skype memory leaks fixed git-svn-id: http://svn.miranda-ng.org/main/trunk@4926 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Skype/src/skype.cpp | 5 +---- protocols/Skype/src/skype_database.cpp | 4 ++-- protocols/Skype/src/skype_dialogs.cpp | 4 +--- protocols/Skype/src/skype_instances.cpp | 7 ++++++- protocols/Skype/src/skype_messages.cpp | 2 +- protocols/Skype/src/skype_profile.cpp | 2 +- protocols/Skype/src/skype_proto.h | 1 + protocols/Skype/src/string_list.h | 4 ++-- 8 files changed, 15 insertions(+), 14 deletions(-) (limited to 'protocols') diff --git a/protocols/Skype/src/skype.cpp b/protocols/Skype/src/skype.cpp index 057350e3dd..04bed2caeb 100644 --- a/protocols/Skype/src/skype.cpp +++ b/protocols/Skype/src/skype.cpp @@ -208,9 +208,6 @@ extern "C" int __declspec(dllexport) Unload(void) { CSkypeProto::UninitIcons(); CSkypeProto::UninitMenus(); - - //this->stop(); - //delete this->skypeKit; - + CSkypeProto::UninitInstances(); return 0; } \ No newline at end of file diff --git a/protocols/Skype/src/skype_database.cpp b/protocols/Skype/src/skype_database.cpp index 2aca8bd1f3..2ee7a22eca 100644 --- a/protocols/Skype/src/skype_database.cpp +++ b/protocols/Skype/src/skype_database.cpp @@ -92,7 +92,7 @@ void CSkypeProto::RaiseMessageSentEvent(HANDLE hContact, DWORD timestamp, SEBina int guidLen = (int)guid.size(); int msgLen = (int)::strlen(message) + 1; - char *msg = (char *)::mir_alloc(msgLen + guidLen); + ptrA msg((char *)::mir_alloc(msgLen + guidLen)); ::strcpy(msg, message); msg[msgLen - 1] = 0; @@ -108,5 +108,5 @@ void CSkypeProto::RaiseMessageSentEvent(HANDLE hContact, DWORD timestamp, SEBina timestamp, flags, msgLen + guidLen, - (PBYTE)msg); + (PBYTE)(char*)msg); } diff --git a/protocols/Skype/src/skype_dialogs.cpp b/protocols/Skype/src/skype_dialogs.cpp index 7c7d88ebcf..883a0227e0 100644 --- a/protocols/Skype/src/skype_dialogs.cpp +++ b/protocols/Skype/src/skype_dialogs.cpp @@ -705,7 +705,7 @@ INT_PTR CALLBACK CSkypeProto::HomeSkypeDlgProc(HWND hwndDlg, UINT msg, WPARAM wP { if (g_countries[i].id != 0xFFFF && g_countries[i].id != 0) { - wchar_t *country = mir_a2t(g_countries[i].szName); + ptrT country( mir_a2t(g_countries[i].szName)); int nItem = ::SendMessage( ::GetDlgItem(hwndDlg, IDC_COUNTRY), CB_ADDSTRING, @@ -720,8 +720,6 @@ INT_PTR CALLBACK CSkypeProto::HomeSkypeDlgProc(HWND hwndDlg, UINT msg, WPARAM wP if (countr && ::wcscmp(country, countr) == 0) ::SendMessage(GetDlgItem(hwndDlg, IDC_COUNTRY), CB_SETCURSEL, nItem, 0); - - ::mir_free(country); } } diff --git a/protocols/Skype/src/skype_instances.cpp b/protocols/Skype/src/skype_instances.cpp index bde45547b8..603a551a03 100644 --- a/protocols/Skype/src/skype_instances.cpp +++ b/protocols/Skype/src/skype_instances.cpp @@ -64,4 +64,9 @@ int CSkypeProto::UninitSkypeProto(CSkypeProto* ppro) delete ppro; return 0; -} \ No newline at end of file +} + +void CSkypeProto::UninitInstances() +{ + instanceList.destroy(); +} diff --git a/protocols/Skype/src/skype_messages.cpp b/protocols/Skype/src/skype_messages.cpp index 8a52946627..3619de3382 100644 --- a/protocols/Skype/src/skype_messages.cpp +++ b/protocols/Skype/src/skype_messages.cpp @@ -96,7 +96,7 @@ void CSkypeProto::OnMessageSent(const ConversationRef &conversation, const Messa message->GetPropConsumptionStatus(status); message->GetPropBodyXml(data); - char *text = CSkypeProto::RemoveHtml(data); + ptrA text( CSkypeProto::RemoveHtml(data)); CParticipant::Refs participants; conversation->GetParticipants(participants, CConversation::OTHER_CONSUMERS); diff --git a/protocols/Skype/src/skype_profile.cpp b/protocols/Skype/src/skype_profile.cpp index 391dbff192..ba77799948 100644 --- a/protocols/Skype/src/skype_profile.cpp +++ b/protocols/Skype/src/skype_profile.cpp @@ -112,7 +112,7 @@ void CSkypeProto::UpdateProfileCountry(SEObject *obj, HANDLE hContact) else { country = (char *)CallService(MS_UTILS_GETCOUNTRYBYISOCODE, (WPARAM)isocode, 0); - ::db_set_ws(hContact, this->m_szModuleName, "Country", ::mir_a2t(country)); + ::db_set_ws(hContact, this->m_szModuleName, "Country", _A2T(country)); } } diff --git a/protocols/Skype/src/skype_proto.h b/protocols/Skype/src/skype_proto.h index 38f68e9557..c87cb73307 100644 --- a/protocols/Skype/src/skype_proto.h +++ b/protocols/Skype/src/skype_proto.h @@ -146,6 +146,7 @@ public: static int UninitSkypeProto(CSkypeProto* ppro); static CSkypeProto* GetInstanceByHContact(HANDLE hContact); + static void UninitInstances(); // icons static void InitIcons(); diff --git a/protocols/Skype/src/string_list.h b/protocols/Skype/src/string_list.h index df1ce7b0fa..60921746b5 100644 --- a/protocols/Skype/src/string_list.h +++ b/protocols/Skype/src/string_list.h @@ -18,10 +18,10 @@ public: wchar_t *p = ::wcstok(data, delimeters); if (p) { - this->strings.push_back(::mir_wstrdup(p)); + this->strings.push_back(p); while (p = wcstok(NULL, delimeters)) { - this->strings.push_back(::mir_wstrdup(p)); + this->strings.push_back(p); } } ::mir_free(data); -- cgit v1.2.3