summaryrefslogtreecommitdiff
path: root/plugins/wbOSD
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/wbOSD
parentffc5a3d7550528281976745279e77ac9faba551b (diff)
major code cleaning in regard to db_event_getBlobSize & event memory allocation
Diffstat (limited to 'plugins/wbOSD')
-rw-r--r--plugins/wbOSD/src/events.cpp13
1 files changed, 3 insertions, 10 deletions
diff --git a/plugins/wbOSD/src/events.cpp b/plugins/wbOSD/src/events.cpp
index 81429c9b09..e82fd92025 100644
--- a/plugins/wbOSD/src/events.cpp
+++ b/plugins/wbOSD/src/events.cpp
@@ -129,12 +129,8 @@ int ContactStatusChanged(WPARAM wParam, LPARAM lParam)
int HookedNewEvent(WPARAM wParam, LPARAM hDBEvent)
{
logmsg("HookedNewEvent1");
- DBEVENTINFO dbe;
- dbe.cbBlob = db_event_getBlobSize(hDBEvent);
- if (dbe.cbBlob == -1)
- return 0;
-
- dbe.pBlob = (PBYTE)malloc(dbe.cbBlob);
+ DB::EventInfo dbe;
+ dbe.cbBlob = -1;
if (db_event_get(hDBEvent, &dbe))
return 0;
@@ -182,7 +178,7 @@ int HookedNewEvent(WPARAM wParam, LPARAM hDBEvent)
pbuf++;
}
- wchar_t *c1 = nullptr, *c2 = nullptr;
+ ptrW c1, c2;
if (i1 == 1)
c1 = mir_wstrdup(Clist_GetContactDisplayName(wParam));
else if (i1 == 2)
@@ -196,8 +192,5 @@ int HookedNewEvent(WPARAM wParam, LPARAM hDBEvent)
wchar_t buffer[512];
mir_snwprintf(buffer, buf, c1, c2);
ShowOSD(buffer, 0, g_plugin.getDword("clr_msg", DEFAULT_CLRMSG), wParam);
-
- mir_free(c1);
- mir_free(c2);
return 0;
}