From 57125f88567ba481594204c08d3eff983c3017c8 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 7 Nov 2018 23:07:51 +0300 Subject: IEHistory: memory allocation fix --- plugins/IEHistory/src/dlgHandlers.cpp | 5 ++--- plugins/IEHistory/src/utils.cpp | 10 ---------- plugins/IEHistory/src/utils.h | 1 - 3 files changed, 2 insertions(+), 14 deletions(-) (limited to 'plugins/IEHistory') diff --git a/plugins/IEHistory/src/dlgHandlers.cpp b/plugins/IEHistory/src/dlgHandlers.cpp index b4a70b1866..f5db4c4597 100644 --- a/plugins/IEHistory/src/dlgHandlers.cpp +++ b/plugins/IEHistory/src/dlgHandlers.cpp @@ -69,11 +69,10 @@ void LoadName(HWND hWnd) SetWindowText(hWnd, TranslateT("System History")); return; } - wchar_t *szOther = GetContactName(data->contact); + wchar_t buffer[1024]; - sntprintf(buffer, 1024, L"'%s' - IEHistory", szOther); + sntprintf(buffer, 1024, L"'%s' - IEHistory", ptrW(Contact_GetInfo(CNF_DISPLAY, data->contact)).get()); SetWindowText(hWnd, buffer); - mir_free(szOther); } int LoadIEView(HWND hWnd) diff --git a/plugins/IEHistory/src/utils.cpp b/plugins/IEHistory/src/utils.cpp index fc40eeba25..d1699bdb45 100644 --- a/plugins/IEHistory/src/utils.cpp +++ b/plugins/IEHistory/src/utils.cpp @@ -74,16 +74,6 @@ int Info(char *title, char *format, ...) return MessageBoxA(nullptr, str, title, MB_OK | MB_ICONINFORMATION); } -/* -returns the name of a contact -*/ - -wchar_t* GetContactName(MCONTACT contact) -{ - ptrW name(Contact_GetInfo(CNF_DISPLAY, contact)); - return (name) ? wcsdup(name) : nullptr; -} - /* Moves a control with regard to certain anchors (like delphi, c#, ...) Somebody please improve on this code ... diff --git a/plugins/IEHistory/src/utils.h b/plugins/IEHistory/src/utils.h index a8c98ef30b..55c076a475 100644 --- a/plugins/IEHistory/src/utils.h +++ b/plugins/IEHistory/src/utils.h @@ -68,7 +68,6 @@ int Log(char *format, ...); void ScreenToClient(HWND hWnd, LPRECT rect); int Info(char *title, char *format, ...); -wchar_t *GetContactName(MCONTACT contact); void AnchorMoveWindow(HWND window, const WINDOWPOS *parentPos, int anchors); RECT AnchorCalcPos(HWND window, const RECT *rParent, const WINDOWPOS *parentPos, int anchors); -- cgit v1.2.3