diff options
author | George Hazan <george.hazan@gmail.com> | 2013-05-06 16:07:39 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-05-06 16:07:39 +0000 |
commit | f94f16702b87c3c876096723f8e6ad94d63847aa (patch) | |
tree | b0cd74c1351429b4748474557aabfd56c2150323 /protocols/Skype/src/skype_contacts.cpp | |
parent | 27d17244cb0af6f8b04e2b6725d504c336dabb07 (diff) |
more mem leaks
git-svn-id: http://svn.miranda-ng.org/main/trunk@4593 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Skype/src/skype_contacts.cpp')
-rw-r--r-- | protocols/Skype/src/skype_contacts.cpp | 35 |
1 files changed, 10 insertions, 25 deletions
diff --git a/protocols/Skype/src/skype_contacts.cpp b/protocols/Skype/src/skype_contacts.cpp index f50d60e416..aacbe82006 100644 --- a/protocols/Skype/src/skype_contacts.cpp +++ b/protocols/Skype/src/skype_contacts.cpp @@ -47,12 +47,11 @@ void CSkypeProto::UpdateContactStatus(HANDLE hContact, CContact::Ref contact) void CSkypeProto::UpdateContactNickName(SEObject *obj, HANDLE hContact)
{
// todo: P_DISPLAYNAME = 21 is unworked
- wchar_t *nick = ::mir_utf8decodeW(obj->GetStrProp(/* *::P_FULLNAME */ 5));
+ mir_ptr<wchar_t> nick( ::mir_utf8decodeW(obj->GetStrProp(/* *::P_FULLNAME */ 5)));
if ( !::wcslen(nick))
::db_unset(hContact, this->m_szModuleName, "Nick");
else
::db_set_ws(hContact, this->m_szModuleName, "Nick", nick);
- ::mir_free(nick);
}
void CSkypeProto::UpdateContactOnlineSinceTime(SEObject *obj, HANDLE hContact)
@@ -83,8 +82,7 @@ void CSkypeProto::OnContactChanged(CContact::Ref contact, int prop) if (hContact)
{
- switch(prop)
- {
+ switch(prop) {
case CContact::P_AUTHREQ_TIMESTAMP:
{
uint newTS = 0;
@@ -199,7 +197,7 @@ HANDLE CSkypeProto::GetContactFromAuthEvent(HANDLE hEvent) HANDLE CSkypeProto::AddContact(CContact::Ref contact)
{
- wchar_t *sid = ::mir_utf8decodeW(contact->GetSid());
+ mir_ptr<wchar_t> sid( ::mir_utf8decodeW(contact->GetSid()));
CContact::AVAILABILITY availability;
contact->GetPropAvailability(availability);
@@ -210,10 +208,9 @@ HANDLE CSkypeProto::AddContact(CContact::Ref contact) hContact = (HANDLE)::CallService(MS_DB_CONTACT_ADD, 0, 0);
::CallService(MS_PROTO_ADDTOCONTACT, (WPARAM)hContact, (LPARAM)this->m_szModuleName);
- wchar_t *nick = ::mir_utf8decodeW(contact->GetNick());
+ mir_ptr<wchar_t> nick( ::mir_utf8decodeW(contact->GetNick()));
- switch(availability)
- {
+ switch(availability) {
case CContact::SKYPEOUT:
::db_set_b(hContact, this->m_szModuleName, "IsSkypeOut", 1);
break;
@@ -242,12 +239,8 @@ HANDLE CSkypeProto::AddContact(CContact::Ref contact) db_set_ts(hContact, "CList", "Group", dbv.ptszVal);
db_free(&dbv);
}
-
- ::mir_free(nick);
}
- ::mir_free(sid);
-
return hContact;
}
@@ -388,15 +381,13 @@ void CSkypeProto::OnContactFinded(CContact::Ref contact, HANDLE hSearch) {
contact->GetPropEmails(data);
- wchar_t *emails = ::mir_utf8decodeW(data);
+ mir_ptr<wchar_t> emails( ::mir_utf8decodeW(data));
wchar_t* main = ::wcstok(emails, L" ");
if (main != NULL)
{
psr.email = main;
}
-
- ::mir_free(emails);
}
this->SendBroadcast(ACKTYPE_SEARCH, ACKRESULT_DATA, hSearch, (LPARAM)&psr);
@@ -404,7 +395,7 @@ void CSkypeProto::OnContactFinded(CContact::Ref contact, HANDLE hSearch) void __cdecl CSkypeProto::SearchBySidAsync(void* arg)
{
- wchar_t *sid = (wchar_t*)arg;
+ mir_ptr<wchar_t> sid((wchar_t*)arg);
HANDLE hContact = this->GetContactBySid(sid);
if (hContact)
@@ -425,18 +416,15 @@ void __cdecl CSkypeProto::SearchBySidAsync(void* arg) bool valid;
if (!search->IsValid(valid) || !valid || !search->Submit())
- {
return;
- }
+
search->BlockWhileSearch();
search->Release();
-
- ::mir_free(sid);
}
void __cdecl CSkypeProto::SearchByEmailAsync(void* arg)
{
- wchar_t *email = (wchar_t *)arg;
+ mir_ptr<wchar_t> email((wchar_t *)arg);
CContactSearch::Ref search;
g_skype->CreateContactSearch(search);
@@ -449,13 +437,10 @@ void __cdecl CSkypeProto::SearchByEmailAsync(void* arg) bool valid;
if (!search->AddEmailTerm(::mir_u2a(email), valid) || !valid || !search->Submit())
- {
return;
- }
+
search->BlockWhileSearch();
search->Release();
-
- ::mir_free(email);
}
void __cdecl CSkypeProto::SearchByNamesAsync(void* arg)
|