summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-11-29 19:34:27 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-11-29 19:34:27 +0000
commit7c51a5c643c99f624147bd0fb56f5c29d65fd5dc (patch)
tree49e6b7335da49ae9a0527b8a0c9c17f047d5f2f4
parent74a7275c9ae50d84abf5ffd80fe448be91c2df19 (diff)
finally catched wrong memory allocation in variables
git-svn-id: http://svn.miranda-ng.org/main/trunk@11156 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--plugins/Variables/src/parse_miranda.cpp27
1 files changed, 7 insertions, 20 deletions
diff --git a/plugins/Variables/src/parse_miranda.cpp b/plugins/Variables/src/parse_miranda.cpp
index 6516b5ea18..335df51fb3 100644
--- a/plugins/Variables/src/parse_miranda.cpp
+++ b/plugins/Variables/src/parse_miranda.cpp
@@ -416,7 +416,7 @@ static TCHAR* parseProtoInfo(ARGUMENTSINFO *ai)
char *szRes = NULL;
TCHAR *tszRes = NULL;
- char *szProto = mir_t2a(ai->targv[1]);
+ ptrA szProto(mir_t2a(ai->targv[1]));
if (!_tcscmp(ai->targv[2], _T(STR_PINAME)))
tszRes = Hlp_GetProtocolName(szProto);
@@ -424,42 +424,29 @@ static TCHAR* parseProtoInfo(ARGUMENTSINFO *ai)
if (!ProtoServiceExists(szProto, PS_GETCAPS))
return NULL;
- char *szText = (char *)CallProtoService(szProto, PS_GETCAPS, (WPARAM)PFLAG_UNIQUEIDTEXT, 0);
- if (szText != NULL)
- szRes = _strdup(szText);
+ szRes = (char *)CallProtoService(szProto, PS_GETCAPS, (WPARAM)PFLAG_UNIQUEIDTEXT, 0);
}
else if (!_tcscmp(ai->targv[2], _T(STR_PIUIDSETTING))) {
if (!ProtoServiceExists(szProto, PS_GETCAPS))
return NULL;
- char *szText = (char *)CallProtoService(szProto, PS_GETCAPS, (WPARAM)PFLAG_UNIQUEIDSETTING, 0);
- if (szText != NULL)
- szRes = _strdup(szText);
+ szRes = (char *)CallProtoService(szProto, PS_GETCAPS, (WPARAM)PFLAG_UNIQUEIDSETTING, 0);
}
- else if (!_tcscmp(ai->targv[2], _T(STR_PINICK)))
- {
+ else if (!_tcscmp(ai->targv[2], _T(STR_PINICK))) {
CONTACTINFO ci;
-
ci.cbSize = sizeof(CONTACTINFO);
ci.dwFlag = CNF_DISPLAY | CNF_UNICODE;
ci.hContact = NULL;
ci.szProto = szProto;
CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&ci);
-
- tszRes = mir_tstrdup(ci.pszVal);
-
- mir_free(ci.pszVal);
+ tszRes = ci.pszVal;
}
- mir_free(szProto);
+
if (szRes == NULL && tszRes == NULL)
return NULL;
- if (szRes != NULL && tszRes == NULL) {
+ if (szRes != NULL && tszRes == NULL)
tszRes = mir_a2t(szRes);
- mir_free(szRes);
- }
- else if (szRes != NULL && tszRes != NULL)
- mir_free(szRes);
return tszRes;
}