From 6607b3e491653046d492e9403b4edf669cd40ecb Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 11 Dec 2023 20:06:43 +0300 Subject: =?UTF-8?q?fixes=20#4041=20(=D0=9F=D0=B0=D0=B4=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D0=B5=20=D0=BF=D1=80=D0=B8=20=D0=BF=D0=BE=D0=BF=D1=8B=D1=82?= =?UTF-8?q?=D0=BA=D0=B5=20=D0=B8=D0=BC=D0=BF=D0=BE=D1=80=D1=82=D0=B8=D1=80?= =?UTF-8?q?=D0=BE=D0=B2=D0=B0=D1=82=D1=8C=20=D0=B8=D1=81=D1=82=D0=BE=D1=80?= =?UTF-8?q?=D0=B8=D1=8E=20=D0=B2=20=D0=BA=D0=BE=D0=BD=D1=82=D0=B0=D0=BA?= =?UTF-8?q?=D1=82=D0=B0=20YAMN)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/Import/src/import.cpp | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'plugins/Import/src') diff --git a/plugins/Import/src/import.cpp b/plugins/Import/src/import.cpp index 2ad6ce1605..e743d13cc8 100644 --- a/plugins/Import/src/import.cpp +++ b/plugins/Import/src/import.cpp @@ -878,8 +878,6 @@ void CImportBatch::ImportHistory(MCONTACT hContact, PROTOACCOUNT **protocol, int else hDst = NULL; bool bSkipAll = false; - int cbAlloc = 4096; - uint8_t *eventBuf = (uint8_t*)mir_alloc(cbAlloc); // Get the start of the event chain int i = 0; @@ -888,16 +886,12 @@ void CImportBatch::ImportHistory(MCONTACT hContact, PROTOACCOUNT **protocol, int i++; // Copy the event and import it - DBEVENTINFO dbei = {}; + DB::EventInfo dbei; dbei.cbBlob = srcDb->GetBlobSize(hEvent); - if (dbei.cbBlob > cbAlloc) { - cbAlloc = dbei.cbBlob + 4096 - dbei.cbBlob % 4096; - eventBuf = (uint8_t*)mir_realloc(eventBuf, cbAlloc); - } - dbei.pBlob = eventBuf; + dbei.pBlob = (uint8_t*)mir_alloc(dbei.cbBlob+1); bool bSkipThis = false; - if (!srcDb->GetEvent(hEvent, &dbei)) { + if (!srcDb->GetEvent(hEvent, &dbei)) { if (dbei.szModule == nullptr) dbei.szModule = szProto; @@ -982,7 +976,6 @@ void CImportBatch::ImportHistory(MCONTACT hContact, PROTOACCOUNT **protocol, int if (bSkipAll) break; } - mir_free(eventBuf); } ///////////////////////////////////////////////////////////////////////////////////////// -- cgit v1.2.3