From d1714aa0580ec116d0d95bcaabecf35fbfbfe10c Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 6 May 2013 14:40:36 +0000 Subject: some crash fixes for Skype git-svn-id: http://svn.miranda-ng.org/main/trunk@4589 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Skype/src/skype_database.cpp | 11 +++++------ protocols/Skype/src/skype_profile.cpp | 6 +++--- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/protocols/Skype/src/skype_database.cpp b/protocols/Skype/src/skype_database.cpp index d94528c5f4..f087f96412 100644 --- a/protocols/Skype/src/skype_database.cpp +++ b/protocols/Skype/src/skype_database.cpp @@ -9,27 +9,26 @@ bool CSkypeProto::IsMessageInDB(HANDLE hContact, DWORD timestamp, const char *gu { DBEVENTINFO dbei = { sizeof(dbei) }; dbei.cbBlob = ::db_event_getBlobSize(hDbEvent); - dbei.pBlob = (PBYTE)::mir_alloc(dbei.cbBlob); + if (dbei.cbBlob < 32) + continue; + + mir_ptr blob((PBYTE)::mir_alloc(dbei.cbBlob)); + dbei.pBlob = blob; ::db_event_get(hDbEvent, &dbei); if (dbei.timestamp < timestamp) - { - ::mir_free(dbei.pBlob); break; - } int sendFlag = dbei.flags & DBEF_SENT; if (dbei.eventType == EVENTTYPE_MESSAGE && sendFlag == flag) { if (::memcmp(&dbei.pBlob[dbei.cbBlob - 32], guid, 32) == 0) { - ::mir_free(dbei.pBlob); result = true; break; } } - ::mir_free(dbei.pBlob); hDbEvent = ::db_event_prev(hDbEvent); } diff --git a/protocols/Skype/src/skype_profile.cpp b/protocols/Skype/src/skype_profile.cpp index 5495558b83..1240cf8272 100644 --- a/protocols/Skype/src/skype_profile.cpp +++ b/protocols/Skype/src/skype_profile.cpp @@ -325,14 +325,14 @@ void CSkypeProto::UpdateProfile(SEObject *obj, HANDLE hContact) void __cdecl CSkypeProto::LoadOwnInfo(void *) { - std::wstring nick = ::db_get_wsa(NULL, this->m_szModuleName, "Nick"); - if (nick.empty()) + mir_ptr nick( ::db_get_wsa(NULL, this->m_szModuleName, "Nick")); + if (nick == NULL) { SEString data; this->account->GetPropFullname(data); nick = ::mir_utf8decodeW(data); - ::db_set_ws(NULL, this->m_szModuleName, "Nick", nick.c_str()); + ::db_set_ws(NULL, this->m_szModuleName, "Nick", nick); } this->UpdateProfileAvatar(this->account.fetch()); this->UpdateProfile(this->account.fetch()); -- cgit v1.2.3