summaryrefslogtreecommitdiff
path: root/protocols/Steam
diff options
context:
space:
mode:
authorRobert Pösel <robyer@seznam.cz>2014-11-22 14:16:08 +0000
committerRobert Pösel <robyer@seznam.cz>2014-11-22 14:16:08 +0000
commit385f65476c31ba54b37d8a95aeaa3e657a11a1bb (patch)
treeb6a1822401894d42c1700a0e70511447b83d24c0 /protocols/Steam
parentc4ec14219941c5f9a359359946212bc6c6c2e459 (diff)
Steam: One more fix for json parsing
git-svn-id: http://svn.miranda-ng.org/main/trunk@11039 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Steam')
-rw-r--r--protocols/Steam/src/steam_account.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/protocols/Steam/src/steam_account.cpp b/protocols/Steam/src/steam_account.cpp
index d565293ccb..fa4cdf1804 100644
--- a/protocols/Steam/src/steam_account.cpp
+++ b/protocols/Steam/src/steam_account.cpp
@@ -21,10 +21,14 @@ void CSteamProto::OnGotRsaKey(const NETLIBHTTPREQUEST *response, void *arg)
// load rsa key parts
JSONNODE *root = json_parse(response->pData), *node;
- if (!root) return;
+ if (!root)
+ return;
node = json_get(root, "success");
- if (!json_as_bool(node)) return;
+ if (!json_as_bool(node)) {
+ json_delete(root);
+ return;
+ }
node = json_get(root, "publickey_mod");
ptrA modulus(mir_u2a(json_as_string(node)));
@@ -183,25 +187,24 @@ void CSteamProto::OnAuthorization(const NETLIBHTTPREQUEST *response, void *arg)
return;
}
- json_delete(root);
-
node = json_get(root, "oauth");
- root = json_parse(ptrA(mir_u2a(json_as_string(node))));
+ JSONNODE *nroot = json_parse(ptrA(mir_u2a(json_as_string(node))));
- node = json_get(root, "steamid");
+ node = json_get(nroot, "steamid");
ptrA steamId(mir_u2a(json_as_string(node)));
setString("SteamID", steamId);
- node = json_get(root, "oauth_token");
+ node = json_get(nroot, "oauth_token");
ptrA token(mir_u2a(json_as_string(node)));
setString("TokenSecret", token);
- node = json_get(root, "webcookie");
+ node = json_get(nroot, "webcookie");
ptrA cookie(mir_u2a(json_as_string(node)));
delSetting("Timestamp");
delSetting("EncryptedPassword");
+ json_delete(nroot);
json_delete(root);
PushRequest(