From 124c695427c4999bd6a4ec97735b6fcac8975474 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 12 Sep 2014 14:45:54 +0000 Subject: a couple of memleaks in json parser git-svn-id: http://svn.miranda-ng.org/main/trunk@10439 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/VKontakte/src/vk_chats.cpp | 4 ++-- protocols/VKontakte/src/vk_thread.cpp | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'protocols/VKontakte/src') diff --git a/protocols/VKontakte/src/vk_chats.cpp b/protocols/VKontakte/src/vk_chats.cpp index e24e4023b1..6c4f9e7fc8 100644 --- a/protocols/VKontakte/src/vk_chats.cpp +++ b/protocols/VKontakte/src/vk_chats.cpp @@ -133,7 +133,7 @@ void CVkProto::OnReceiveChatInfo(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe cc->m_admin_id = json_as_int(json_get(info, "admin_id")); } - JSONNODE *users = json_as_array(json_get(pResponse, "users")); + JSONNODE *users = json_get(pResponse, "users"); if (users != NULL) { for (int i = 0; i < cc->m_users.getCount(); i++) cc->m_users[i].m_bDel = true; @@ -194,7 +194,7 @@ void CVkProto::OnReceiveChatInfo(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe JSONNODE *msgs = json_get(pResponse, "msgs"); if (msgs != NULL) { int numMessages = json_as_int(json_get(msgs, "count")); - msgs = json_as_array(json_get(msgs, "items")); + msgs = json_get(msgs, "items"); if (msgs != NULL){ for (int i = 0; i < numMessages; i++) { JSONNODE *pMsg = json_at(msgs, i); diff --git a/protocols/VKontakte/src/vk_thread.cpp b/protocols/VKontakte/src/vk_thread.cpp index 05494e53f7..4e534ec2e9 100644 --- a/protocols/VKontakte/src/vk_thread.cpp +++ b/protocols/VKontakte/src/vk_thread.cpp @@ -423,9 +423,11 @@ void CVkProto::OnReceiveFriends(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq setTString(hContact, "Phone", szValue); szValue = json_as_string(json_get(pInfo, "status")); - if (szValue && *szValue) - if (_tcscmp(db_get_tsa(hContact, "CList", "StatusMsg"), szValue)) + if (szValue && *szValue) { + ptrT tszOldStatus(db_get_tsa(hContact, "CList", "StatusMsg")); + if (_tcscmp(tszOldStatus, szValue)) db_set_ts(hContact, "CList", "StatusMsg", szValue); + } szValue = json_as_string(json_get(pInfo, "about")); if (szValue && *szValue) -- cgit v1.2.3