diff options
author | George Hazan <ghazan@miranda.im> | 2021-06-05 17:50:34 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2021-06-05 17:50:34 +0300 |
commit | d7c9eb34f80f207efd47d2fc65e31aedf166c323 (patch) | |
tree | 338b9b905674dc31b1efab739dfcedeed3d8d7b3 /plugins/Dbx_sqlite | |
parent | ffc5a3d7550528281976745279e77ac9faba551b (diff) |
major code cleaning in regard to db_event_getBlobSize & event memory allocation
Diffstat (limited to 'plugins/Dbx_sqlite')
-rwxr-xr-x | plugins/Dbx_sqlite/src/dbevents.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/plugins/Dbx_sqlite/src/dbevents.cpp b/plugins/Dbx_sqlite/src/dbevents.cpp index cbfa67485a..6244928107 100755 --- a/plugins/Dbx_sqlite/src/dbevents.cpp +++ b/plugins/Dbx_sqlite/src/dbevents.cpp @@ -307,7 +307,12 @@ BOOL CDbxSQLite::GetEvent(MEVENT hDbEvent, DBEVENTINFO *dbei) dbei->flags = sqlite3_column_int64(stmt, 3); DWORD cbBlob = sqlite3_column_int64(stmt, 4); - int bytesToCopy = (dbei->cbBlob < cbBlob) ? dbei->cbBlob : cbBlob; + size_t bytesToCopy = cbBlob; + if (dbei->cbBlob == -1) + dbei->pBlob = (PBYTE)mir_calloc(cbBlob + 2); + else if (dbei->cbBlob < cbBlob) + bytesToCopy = dbei->cbBlob; + dbei->cbBlob = cbBlob; if (bytesToCopy && dbei->pBlob) { BYTE *data = (BYTE *)sqlite3_column_blob(stmt, 5); |