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/NewStory/src/history.cpp | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) (limited to 'plugins/NewStory') diff --git a/plugins/NewStory/src/history.cpp b/plugins/NewStory/src/history.cpp index f0f3fae9a4..d69706efad 100644 --- a/plugins/NewStory/src/history.cpp +++ b/plugins/NewStory/src/history.cpp @@ -709,17 +709,8 @@ public: bool bAppendOnly = false; DB::ECPTR pCursor(DB::Events(m_hContact)); while (MEVENT hDbEvent = pCursor.FetchNext()) { - DBEVENTINFO dbei = {}; - int nSize = db_event_getBlobSize(hDbEvent); - if (nSize > 0) { - dbei.cbBlob = nSize; - dbei.pBlob = (PBYTE)mir_alloc(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 - } - + DB::EventInfo dbei; + dbei.cbBlob = -1; if (!db_event_get(hDbEvent, &dbei)) { if (bAppendOnly) { SetFilePointer(hFile, -3, nullptr, FILE_END); @@ -753,8 +744,6 @@ public: output += "\n]}"; WriteFile(hFile, output.c_str(), (int)output.size(), &dwBytesWritten, nullptr); - if (dbei.pBlob) - mir_free(dbei.pBlob); } bAppendOnly = true; -- cgit v1.2.3