From fbb5d3456c540866ccc249c35b656def0219d8fb Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 14 Apr 2015 13:40:54 +0000 Subject: some minor memleaks fixed git-svn-id: http://svn.miranda-ng.org/main/trunk@12807 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/BuddyPounce/src/Version.h | 22 +++++++++++----------- plugins/BuddyPounce/src/dialog.cpp | 7 ++----- plugins/BuddyPounce/src/headers.h | 1 + plugins/BuddyPounce/src/main.cpp | 3 +-- 4 files changed, 15 insertions(+), 18 deletions(-) diff --git a/plugins/BuddyPounce/src/Version.h b/plugins/BuddyPounce/src/Version.h index 1c5545ba8d..0939edb777 100644 --- a/plugins/BuddyPounce/src/Version.h +++ b/plugins/BuddyPounce/src/Version.h @@ -1,14 +1,14 @@ -#define __MAJOR_VERSION 0 -#define __MINOR_VERSION 3 -#define __RELEASE_NUM 2 -#define __BUILD_NUM 1 +#define __MAJOR_VERSION 0 +#define __MINOR_VERSION 3 +#define __RELEASE_NUM 2 +#define __BUILD_NUM 2 #include -#define __PLUGIN_NAME "Buddy pounce" -#define __FILENAME "BuddyPounce.dll" -#define __DESCRIPTION "Allows you to send a message to contacts if they change status." -#define __AUTHOR "Jonathan Gordon" -#define __AUTHOREMAIL "jdgordy@gmail.com" -#define __AUTHORWEB "http://miranda-ng.org/p/BuddyPounce/" -#define __COPYRIGHT "© 2004 Jonathan Gordon" +#define __PLUGIN_NAME "Buddy pounce" +#define __FILENAME "BuddyPounce.dll" +#define __DESCRIPTION "Allows you to send a message to contacts if they change status." +#define __AUTHOR "Jonathan Gordon" +#define __AUTHOREMAIL "jdgordy@gmail.com" +#define __AUTHORWEB "http://miranda-ng.org/p/BuddyPounce/" +#define __COPYRIGHT "© 2004 Jonathan Gordon" diff --git a/plugins/BuddyPounce/src/dialog.cpp b/plugins/BuddyPounce/src/dialog.cpp index e9be19366a..64f3400f94 100644 --- a/plugins/BuddyPounce/src/dialog.cpp +++ b/plugins/BuddyPounce/src/dialog.cpp @@ -227,12 +227,9 @@ INT_PTR CALLBACK BuddyPounceSimpleDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LP { int length = GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE)) + 1; if (length>1) { - TCHAR *text = (TCHAR*)mir_alloc(length*sizeof(TCHAR)); - if (!text) { - msg(TranslateT("Couldn't allocate enough memory"), _T("")); - break; - } + TCHAR *text = (TCHAR*)_alloca(length*sizeof(TCHAR)); GetDlgItemText(hwnd, IDC_MESSAGE, text, length); + db_set_ts(hContact, modname, "PounceMsg", text); } else db_unset(hContact, modname, "PounceMsg"); } diff --git a/plugins/BuddyPounce/src/headers.h b/plugins/BuddyPounce/src/headers.h index 508f3d03f9..c9157088d4 100644 --- a/plugins/BuddyPounce/src/headers.h +++ b/plugins/BuddyPounce/src/headers.h @@ -7,6 +7,7 @@ #include #include #include +#include #include #include diff --git a/plugins/BuddyPounce/src/main.cpp b/plugins/BuddyPounce/src/main.cpp index 03b8e6cb59..f490a77a10 100644 --- a/plugins/BuddyPounce/src/main.cpp +++ b/plugins/BuddyPounce/src/main.cpp @@ -145,10 +145,9 @@ int CheckDate(MCONTACT hContact) void SendPounce(TCHAR *text, MCONTACT hContact) { - char* pszUtf = mir_utf8encodeT(text); + ptrA pszUtf(mir_utf8encodeT(text)); if (HANDLE hSendId = (HANDLE)CallContactService(hContact, PSS_MESSAGE, PREF_UTF, (LPARAM)pszUtf)) WindowList_Add(hWindowList, (HWND)hSendId, hContact); - } int UserOnlineSettingChanged(WPARAM hContact, LPARAM lParam) -- cgit v1.2.3