summaryrefslogtreecommitdiff
path: root/protocols/VKontakte/src/vk_search.cpp
diff options
context:
space:
mode:
authorSergey Bolhovskoy <elzorfox@ya.ru>2015-01-10 14:02:40 +0000
committerSergey Bolhovskoy <elzorfox@ya.ru>2015-01-10 14:02:40 +0000
commit5ebc752cd3731e2de4140eff3e6fca0e5d82fcf4 (patch)
tree11f557a57f695cc248b1223b36bab57727028269 /protocols/VKontakte/src/vk_search.cpp
parent9b73dafa2f6da6bf60f98e17475c624f0497806b (diff)
VKontakte (detect by coverity) :
fix memory leaks on CMString s=json_as_string(...) fix memory leaks on CVkFileUploadParam::GetType() fix missing break in switch on OnChatEvent fix uninitialized field in CVkChatMessage, CVkChatInfo, AsyncHttpRequest, CVkChatUser fix potential crash in OnReciveUpload version bump git-svn-id: http://svn.miranda-ng.org/main/trunk@11817 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/VKontakte/src/vk_search.cpp')
-rw-r--r--protocols/VKontakte/src/vk_search.cpp32
1 files changed, 22 insertions, 10 deletions
diff --git a/protocols/VKontakte/src/vk_search.cpp b/protocols/VKontakte/src/vk_search.cpp
index b4503fe1b2..6eef22a8f8 100644
--- a/protocols/VKontakte/src/vk_search.cpp
+++ b/protocols/VKontakte/src/vk_search.cpp
@@ -132,12 +132,18 @@ void CVkProto::OnSearch(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq)
PROTOSEARCHRESULT psr = { sizeof(psr) };
psr.flags = PSR_TCHAR;
- psr.id = mir_wstrdup(json_as_string(json_get(pRecord, "id")));
- psr.firstName = mir_wstrdup(json_as_string(json_get(pRecord, "first_name")));
- psr.lastName = mir_wstrdup(json_as_string(json_get(pRecord, "last_name")));
- psr.nick = mir_wstrdup(json_as_string(json_get(pRecord, "nickname")));
+ ptrT pId(json_as_string(json_get(pRecord, "id")));
+ ptrT pFirstName(json_as_string(json_get(pRecord, "first_name")));
+ ptrT pLastName(json_as_string(json_get(pRecord, "last_name")));
+ ptrT pNick(json_as_string(json_get(pRecord, "nickname")));
+ ptrT pDomain(json_as_string(json_get(pRecord, "domain")));
+
+ psr.id = mir_wstrdup(pId);
+ psr.firstName = mir_wstrdup(pFirstName);
+ psr.lastName = mir_wstrdup(pLastName);
+ psr.nick = mir_wstrdup(pNick);
if (!psr.nick || !psr.nick[0])
- psr.nick = mir_wstrdup(json_as_string(json_get(pRecord, "domain")));
+ psr.nick = mir_wstrdup(pDomain);
bool filter = true;
if (pParam) {
@@ -191,11 +197,17 @@ void CVkProto::OnSearchByMail(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq)
PROTOSEARCHRESULT psr = { sizeof(psr) };
psr.flags = PSR_TCHAR;
- psr.id = mir_wstrdup(json_as_string(json_get(pRecord, "id")));
- psr.firstName = mir_wstrdup(json_as_string(json_get(pRecord, "first_name")));
- psr.lastName = mir_wstrdup(json_as_string(json_get(pRecord, "last_name")));
- psr.nick = mir_wstrdup(json_as_string(json_get(pRecord, "nickname")));
- psr.email = mir_wstrdup(json_as_string(json_get(pRecord, "contact")));
+ ptrT pId(json_as_string(json_get(pRecord, "id")));
+ ptrT pFirstName(json_as_string(json_get(pRecord, "first_name")));
+ ptrT pLastName(json_as_string(json_get(pRecord, "last_name")));
+ ptrT pNick(json_as_string(json_get(pRecord, "nickname")));
+ ptrT pEmail(json_as_string(json_get(pRecord, "contact")));
+
+ psr.id = mir_wstrdup(pId);
+ psr.firstName = mir_wstrdup(pFirstName);
+ psr.lastName = mir_wstrdup(pLastName);
+ psr.nick = mir_wstrdup(pNick);
+ psr.email = mir_wstrdup(pEmail);
if (!psr.nick || !psr.nick[0])
psr.nick = psr.email;