From a98c9c3e38deb040415cb57003c634e718b6d64b Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 3 Aug 2017 20:43:28 +0300 Subject: memory allocation fix --- plugins/QuickMessages/src/main.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'plugins') diff --git a/plugins/QuickMessages/src/main.cpp b/plugins/QuickMessages/src/main.cpp index 9508f19899..3e2b651217 100644 --- a/plugins/QuickMessages/src/main.cpp +++ b/plugins/QuickMessages/src/main.cpp @@ -81,8 +81,9 @@ static int InputMenuPopup(WPARAM, LPARAM lParam) if ((qd->dwPos + 254) == mwpd->selection) { CHARRANGE cr; UINT textlenght = 0; - ptrW pszText, ptszQValue, pszCBText; + ptrW pszText, pszCBText; BOOL bIsService = 0; + wchar_t *ptszQValue = nullptr; if (IsClipboardFormatAvailable(CF_TEXT)) { if (OpenClipboard(mwpd->hwnd)) { @@ -114,8 +115,10 @@ static int InputMenuPopup(WPARAM, LPARAM lParam) CallService(mir_u2a(ptszQValue), (WPARAM)mwpd->hContact, 0); } - if (ptszQValue) + if (ptszQValue) { SendMessage(mwpd->hwnd, EM_REPLACESEL, TRUE, (LPARAM)ptszQValue); + free(ptszQValue); + } break; } } @@ -139,7 +142,8 @@ static int CustomButtonPressed(WPARAM, LPARAM lParam) BOOL bCTRL = 0; BOOL bIsService = 0; - ptrW pszText, pszCBText, ptszQValue; + ptrW pszText, pszCBText; + wchar_t *ptszQValue = nullptr; if (IsClipboardFormatAvailable(CF_TEXT)) { if (OpenClipboard(cbcd->hwndFrom)) { @@ -241,6 +245,7 @@ static int CustomButtonPressed(WPARAM, LPARAM lParam) if ((g_bLClickAuto && state != 1) || (g_bRClickAuto && state == 1) || cbcd->flags & BBCF_CONTROLPRESSED || bCTRL) SendMessage(cbcd->hwndFrom, WM_COMMAND, IDOK, 0); } + free(ptszQValue); } return 1; -- cgit v1.2.3