if (rp) {
content = ws_reply_get_content(rp);
- if (content && !json_object_object_get(rp, "error"))
+ if (content && !json_object_object_get(rp, "error")) {
+ json_object_get(content);
+ json_object_put(rp);
return content;
+ }
json_object_put(rp);
}
int ws_get_api_version()
{
- struct json_object *rp, *rq, *j;
+ struct json_object *rp, *rq;
int v;
rq = ws_request_new("getApiLevel");
json_object_put(rq);
if (rp) {
- j = json_object_object_get(rp, "level");
-
- if (j)
- v = json_object_get_int(j);
- else
- v = 0;
+ v = json_object_get_int(json_object_object_get(rp, "level"));
json_object_put(rp);
} else {
if (rp) {
j = json_object_object_get(rp, "session_id");
-
- if (j)
- str = strdup(json_object_get_string(j));
- else
- str = NULL;
+ str = strdup(json_object_get_string(j));
json_object_put(rp);
} else {