diff options
author | Robert Pösel <robyer@seznam.cz> | 2015-10-22 13:37:57 +0000 |
---|---|---|
committer | Robert Pösel <robyer@seznam.cz> | 2015-10-22 13:37:57 +0000 |
commit | 3fb0cb973e22c0e11fe2bf6dd186edc3aae2cf66 (patch) | |
tree | e273c45cc56724147c1fdf5dd8314ae82101cc9a /protocols | |
parent | 5e2886ded2b2214b9e09ee0d08676ed31a32911e (diff) |
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
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/Omegle/src/communication.cpp | 13 |
1 files changed, 5 insertions, 8 deletions
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(", "); } |