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/Variables/src/parse_miranda.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'plugins/Variables/src/parse_miranda.cpp') diff --git a/plugins/Variables/src/parse_miranda.cpp b/plugins/Variables/src/parse_miranda.cpp index b2687e5490..452989048d 100644 --- a/plugins/Variables/src/parse_miranda.cpp +++ b/plugins/Variables/src/parse_miranda.cpp @@ -564,17 +564,12 @@ static wchar_t* parseDbEvent(ARGUMENTSINFO *ai) if (hDbEvent == NULL) return nullptr; - DBEVENTINFO dbe = {}; - dbe.cbBlob = db_event_getBlobSize(hDbEvent); - dbe.pBlob = (PBYTE)mir_calloc(dbe.cbBlob); - if (db_event_get(hDbEvent, &dbe)) { - mir_free(dbe.pBlob); + DB::EventInfo dbe; + dbe.cbBlob = -1; + if (db_event_get(hDbEvent, &dbe)) return nullptr; - } - wchar_t *res = DbEvent_GetTextW(&dbe, CP_ACP); - mir_free(dbe.pBlob); - return res; + return DbEvent_GetTextW(&dbe, CP_ACP); } static wchar_t* parseTranslate(ARGUMENTSINFO *ai) -- cgit v1.2.3