From d7c9eb34f80f207efd47d2fc65e31aedf166c323 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 5 Jun 2021 17:50:34 +0300 Subject: major code cleaning in regard to db_event_getBlobSize & event memory allocation --- plugins/Msg_Export/src/utils.cpp | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) (limited to 'plugins/Msg_Export/src') diff --git a/plugins/Msg_Export/src/utils.cpp b/plugins/Msg_Export/src/utils.cpp index d629ff16f1..e5cba7f1f7 100755 --- a/plugins/Msg_Export/src/utils.cpp +++ b/plugins/Msg_Export/src/utils.cpp @@ -961,18 +961,10 @@ int nExportEvent(WPARAM hContact, LPARAM hDbEvent) bool bExportEvent(MCONTACT hContact, MEVENT hDbEvent, HANDLE hFile, const wstring &sFilePath, bool bAppendOnly) { - DBEVENTINFO dbei = {}; - int nSize = db_event_getBlobSize(hDbEvent); - if (nSize > 0) { - dbei.cbBlob = nSize; - dbei.pBlob = (PBYTE)malloc(dbei.cbBlob + 2); - dbei.pBlob[dbei.cbBlob] = 0; - dbei.pBlob[dbei.cbBlob + 1] = 0; - // Double null terminate, this should prevent most errors - // where the blob received has an invalid format - } - bool result = true; + + DB::EventInfo dbei; + dbei.cbBlob = -1; if (!db_event_get(hDbEvent, &dbei)) { if (db_mc_isMeta(hContact)) hContact = db_event_getContact(hDbEvent); @@ -980,8 +972,7 @@ bool bExportEvent(MCONTACT hContact, MEVENT hDbEvent, HANDLE hFile, const wstrin // Write the event result = ExportDBEventInfo(hContact, hFile, sFilePath, dbei, bAppendOnly); } - if (dbei.pBlob) - free(dbei.pBlob); + return result; } -- cgit v1.2.3