summaryrefslogtreecommitdiff
path: root/plugins/QuickMessages
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2017-08-03 20:43:28 +0300
committerGeorge Hazan <ghazan@miranda.im>2017-08-03 20:43:28 +0300
commita98c9c3e38deb040415cb57003c634e718b6d64b (patch)
tree97ddecaeec79d5822aa6270aa4557b81b14409ae /plugins/QuickMessages
parent0a820f5acd9fe60ad53fde381a83987081c4999d (diff)
memory allocation fix
Diffstat (limited to 'plugins/QuickMessages')
-rw-r--r--plugins/QuickMessages/src/main.cpp11
1 files changed, 8 insertions, 3 deletions
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;