From fe4e211fe45a0b04190d06dbf34fa13883df871a Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 17 Mar 2013 12:04:21 +0000 Subject: more memory fixes git-svn-id: http://svn.miranda-ng.org/main/trunk@4072 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/MyDetails/src/data.cpp | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) (limited to 'plugins/MyDetails') diff --git a/plugins/MyDetails/src/data.cpp b/plugins/MyDetails/src/data.cpp index fa9ebf2ae9..e38c23ce7e 100644 --- a/plugins/MyDetails/src/data.cpp +++ b/plugins/MyDetails/src/data.cpp @@ -239,26 +239,14 @@ bool Protocol::CanSetStatusMsg(int aStatus) void Protocol::GetStatusMsg(int aStatus, TCHAR *msg, size_t msg_size) { if ( !CanGetStatusMsg()) - { lcopystr(msg, _T(""), msg_size); - return; - } - - if (aStatus == status && ProtoServiceExists(name, PS_GETMYAWAYMSG) ) - { - TCHAR *tmp = (TCHAR*) CallProtoService(name, PS_GETMYAWAYMSG, 0, SGMA_TCHAR); + else if (aStatus == status && ProtoServiceExists(name, PS_GETMYAWAYMSG)) { + mir_ptr tmp((TCHAR*)CallProtoService(name, PS_GETMYAWAYMSG, 0, SGMA_TCHAR)); lcopystr(msg, tmp == NULL ? _T("") : tmp, msg_size); } - - else if (ServiceExists(MS_AWAYMSG_GETSTATUSMSG)) - { - TCHAR *tmp = (TCHAR*) CallService(MS_AWAYMSG_GETSTATUSMSGT, (WPARAM)aStatus, 0); - if (tmp != NULL) - { - lcopystr(msg, tmp, msg_size); - mir_free(tmp); - } - else lcopystr(msg, _T(""), msg_size); + else if (ServiceExists(MS_AWAYMSG_GETSTATUSMSG)) { + mir_ptr tmp((TCHAR*)CallService(MS_AWAYMSG_GETSTATUSMSGT, (WPARAM)aStatus, 0)); + lcopystr(msg, tmp == NULL ? _T("") : tmp, msg_size); } } -- cgit v1.2.3