From 3fb0cb973e22c0e11fe2bf6dd186edc3aae2cf66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20P=C3=B6sel?= Date: Thu, 22 Oct 2015 13:37:57 +0000 Subject: Omegle: Fix memleak(s) and "You and the Stranger both like: " string git-svn-id: http://svn.miranda-ng.org/main/trunk@15593 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Omegle/src/communication.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'protocols/Omegle/src') diff --git a/protocols/Omegle/src/communication.cpp b/protocols/Omegle/src/communication.cpp index ba8d28d9d8..16da4da049 100644 --- a/protocols/Omegle/src/communication.cpp +++ b/protocols/Omegle/src/communication.cpp @@ -478,14 +478,11 @@ bool Omegle_client::events() bool newStranger = false; bool waiting = false; - JSONNode *items = json_as_array(root); - - for (size_t i = 0; i < json_size(items); i++) { - JSONNode *child = json_at(items, i); - if (child == NULL) + for (size_t i = 0; i < json_size(root); i++) { + JSONNode *item = json_at(root, i); + if (item == NULL) continue; - JSONNode *item = json_as_array(child); std::string name = _T2A(json_as_string(json_at(item, 0))); if (name == "waiting") { @@ -534,12 +531,12 @@ bool Omegle_client::events() waiting = false; } else if (name == "commonLikes") { - std::tstring likes = TranslateT("You and the Stranger both like: %s"); + std::tstring likes = TranslateT("You and the Stranger both like: "); JSONNode *items = json_as_array(json_at(item, 1)); size_t size = json_size(items); for (size_t i = 0; i < size; i++) { - likes += json_as_string(json_at(items, i)); + likes += ptrT(json_as_string(json_at(items, i))); if (i < size - 1) likes += _T(", "); } -- cgit v1.2.3