diff options
author | George Hazan <george.hazan@gmail.com> | 2013-05-06 14:40:36 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-05-06 14:40:36 +0000 |
commit | d1714aa0580ec116d0d95bcaabecf35fbfbfe10c (patch) | |
tree | 5236711ae2c22e7cfdeb747a0d596c4c155c0aea /protocols/Skype/src | |
parent | 984502e64c8490ba7fb5ac0768762165953a0364 (diff) |
some crash fixes for Skype
git-svn-id: http://svn.miranda-ng.org/main/trunk@4589 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Skype/src')
-rw-r--r-- | protocols/Skype/src/skype_database.cpp | 11 | ||||
-rw-r--r-- | 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<BYTE> 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<wchar_t> 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());
|