From cc5b9e03d48177aeeafdf9d5bd9e51f7963eae56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20P=C3=B6sel?= Date: Sat, 22 Nov 2014 13:04:04 +0000 Subject: Steam: Fix json memleaks all over code; version bump git-svn-id: http://svn.miranda-ng.org/main/trunk@11037 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Steam/src/steam_account.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'protocols/Steam/src/steam_account.cpp') diff --git a/protocols/Steam/src/steam_account.cpp b/protocols/Steam/src/steam_account.cpp index 7bf2645fe9..d565293ccb 100644 --- a/protocols/Steam/src/steam_account.cpp +++ b/protocols/Steam/src/steam_account.cpp @@ -41,6 +41,8 @@ void CSteamProto::OnGotRsaKey(const NETLIBHTTPREQUEST *response, void *arg) ptrA base64RsaEncryptedPassword; ptrA password(getStringA("Password")); + json_delete(root); + DWORD error = 0; DWORD encryptedSize = 0; DWORD passwordSize = (DWORD)strlen(password); @@ -88,6 +90,7 @@ void CSteamProto::OnAuthorization(const NETLIBHTTPREQUEST *response, void *arg) { ShowNotification(TranslateTS(message)); SetStatus(ID_STATUS_OFFLINE); + json_delete(root); return; } @@ -108,8 +111,10 @@ void CSteamProto::OnAuthorization(const NETLIBHTTPREQUEST *response, void *arg) MAKEINTRESOURCE(IDD_GUARD), NULL, CSteamProto::GuardProc, - (LPARAM)&guard) != 1) + (LPARAM)&guard) != 1) { + json_delete(root); return; + } ptrA username(mir_urlEncode(ptrA(mir_utf8encodeW(getWStringA("Username"))))); ptrA base64RsaEncryptedPassword(getStringA("EncryptedPassword")); @@ -153,6 +158,7 @@ void CSteamProto::OnAuthorization(const NETLIBHTTPREQUEST *response, void *arg) if (res != 1) { SetStatus(ID_STATUS_OFFLINE); + json_delete(root); return; } @@ -165,6 +171,7 @@ void CSteamProto::OnAuthorization(const NETLIBHTTPREQUEST *response, void *arg) &CSteamProto::OnAuthorization); } + json_delete(root); return; } @@ -172,9 +179,12 @@ void CSteamProto::OnAuthorization(const NETLIBHTTPREQUEST *response, void *arg) if (!json_as_bool(node)) { SetStatus(ID_STATUS_OFFLINE); + json_delete(root); return; } + json_delete(root); + node = json_get(root, "oauth"); root = json_parse(ptrA(mir_u2a(json_as_string(node)))); @@ -192,6 +202,8 @@ void CSteamProto::OnAuthorization(const NETLIBHTTPREQUEST *response, void *arg) delSetting("Timestamp"); delSetting("EncryptedPassword"); + json_delete(root); + PushRequest( new SteamWebApi::GetSessionRequest(token, steamId, cookie), &CSteamProto::OnGotSession); @@ -241,6 +253,7 @@ void CSteamProto::OnLoggedOn(const NETLIBHTTPREQUEST *response, void *arg) // set status to offline m_iStatus = m_iDesiredStatus = ID_STATUS_OFFLINE; ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)ID_STATUS_CONNECTING, ID_STATUS_OFFLINE); + json_delete(root); return; } @@ -250,6 +263,8 @@ void CSteamProto::OnLoggedOn(const NETLIBHTTPREQUEST *response, void *arg) node = json_get(root, "message"); setDword("MessageID", json_as_int(node)); + json_delete(root); + // load contact list ptrA token(getStringA("TokenSecret")); ptrA steamId(getStringA("SteamID")); -- cgit v1.2.3