summaryrefslogtreecommitdiff
path: root/plugins/NewStory
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2021-06-05 17:50:34 +0300
committerGeorge Hazan <ghazan@miranda.im>2021-06-05 17:50:34 +0300
commitd7c9eb34f80f207efd47d2fc65e31aedf166c323 (patch)
tree338b9b905674dc31b1efab739dfcedeed3d8d7b3 /plugins/NewStory
parentffc5a3d7550528281976745279e77ac9faba551b (diff)
major code cleaning in regard to db_event_getBlobSize & event memory allocation
Diffstat (limited to 'plugins/NewStory')
-rw-r--r--plugins/NewStory/src/history.cpp15
1 files changed, 2 insertions, 13 deletions
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;