diff options
author | Tobias Weimer <wishmaster51@googlemail.com> | 2015-01-10 18:44:06 +0000 |
---|---|---|
committer | Tobias Weimer <wishmaster51@googlemail.com> | 2015-01-10 18:44:06 +0000 |
commit | 2cd05c2649104e8690defdcf0122d8c3e827c1d2 (patch) | |
tree | e778d1ebc66f1942eab066d8de5b0a77e612ef5f /plugins/Variables/src/contact.cpp | |
parent | e5972722ef981be64fe46ca8c07c2c403458e255 (diff) |
Variables:
- Fixed various memory leaks
git-svn-id: http://svn.miranda-ng.org/main/trunk@11821 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Variables/src/contact.cpp')
-rw-r--r-- | plugins/Variables/src/contact.cpp | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/plugins/Variables/src/contact.cpp b/plugins/Variables/src/contact.cpp index 65a92523e4..b5258b422f 100644 --- a/plugins/Variables/src/contact.cpp +++ b/plugins/Variables/src/contact.cpp @@ -107,10 +107,6 @@ BYTE getContactInfoType(TCHAR* type) TCHAR* getContactInfoT(BYTE type, MCONTACT hContact)
{
/* returns dynamic allocated buffer with info, or NULL if failed */
- TCHAR *res = NULL;
- char protoname[128], szVal[16];
- PROTOACCOUNT *pa;
-
if (hContact == NULL)
return NULL;
@@ -118,18 +114,22 @@ TCHAR* getContactInfoT(BYTE type, MCONTACT hContact) if (szProto == NULL)
return NULL;
+ TCHAR *res = NULL;
switch (type) {
case CCNF_PROTOID:
return mir_a2t(szProto);
- case CCNF_ACCOUNT:
- pa = ProtoGetAccount(szProto);
+ case CCNF_ACCOUNT: {
+ PROTOACCOUNT *pa = ProtoGetAccount(szProto);
return pa ? mir_tstrdup(pa->tszAccountName) : NULL;
+ }
- case CCNF_PROTOCOL:
+ case CCNF_PROTOCOL: {
+ char protoname[128];
if (CallProtoService(szProto, PS_GETNAME, (WPARAM)sizeof(protoname), (LPARAM)protoname))
return NULL;
return mir_a2t(protoname);
+ }
case CCNF_STATUS:
return mir_tstrdup((TCHAR*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE), GSMDF_UNICODE));
@@ -165,7 +165,8 @@ TCHAR* getContactInfoT(BYTE type, MCONTACT hContact) ci.hContact = hContact;
ci.dwFlag = type | CNF_UNICODE;
CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&ci);
-
+
+ char szVal[16];
memset(szVal, '\0', sizeof(szVal));
switch(ci.type) {
case CNFT_BYTE:
@@ -334,7 +335,7 @@ int getContactFromString(CONTACTSINFO *ci) return -1;
ci->hContacts[count] = hContact;
- count += 1;
+ count++;
}
}
@@ -346,7 +347,7 @@ int getContactFromString(CONTACTSINFO *ci) cce[cacheSize].flags = ci->flags;
cce[cacheSize].tszContact = mir_tstrdup(tszContact);
if (cce[cacheSize].tszContact != NULL)
- cacheSize += 1;
+ cacheSize++;
}
}
|