mirror of
https://github.com/rsyslog/rsyslog.git
synced 2026-06-20 21:32:56 +02:00
free the tokener and json before all return statements
This commit is contained in:
parent
209dbc95e2
commit
acdc0973c8
@ -427,7 +427,9 @@ int httpfs_permission_to_string(int permission, char* perm_string)
|
|||||||
*/
|
*/
|
||||||
static rsRetVal
|
static rsRetVal
|
||||||
httpfs_parse_exception(char* buf, int length, httpfs_json_remote_exception* jre)
|
httpfs_parse_exception(char* buf, int length, httpfs_json_remote_exception* jre)
|
||||||
{
|
{
|
||||||
|
DEFiRet;
|
||||||
|
|
||||||
if (!length) {
|
if (!length) {
|
||||||
return RS_RET_JSON_PARSE_ERR;
|
return RS_RET_JSON_PARSE_ERR;
|
||||||
}
|
}
|
||||||
@ -438,12 +440,12 @@ httpfs_parse_exception(char* buf, int length, httpfs_json_remote_exception* jre)
|
|||||||
struct json_object *json;
|
struct json_object *json;
|
||||||
json = json_tokener_parse_ex(jt, buf, length);
|
json = json_tokener_parse_ex(jt, buf, length);
|
||||||
if (!json_object_is_type(json, json_type_object)) {
|
if (!json_object_is_type(json, json_type_object)) {
|
||||||
// not an object ?
|
// not an object ?
|
||||||
return RS_RET_JSON_PARSE_ERR;
|
ABORT_FINALIZE(RS_RET_JSON_PARSE_ERR);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!json_object_object_get_ex(json, "RemoteException", &json)) {
|
if (!json_object_object_get_ex(json, "RemoteException", &json)) {
|
||||||
return RS_RET_JSON_PARSE_ERR;
|
ABORT_FINALIZE(RS_RET_JSON_PARSE_ERR);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct json_object *jobj;
|
struct json_object *jobj;
|
||||||
@ -459,11 +461,14 @@ httpfs_parse_exception(char* buf, int length, httpfs_json_remote_exception* jre)
|
|||||||
json_object_object_get_ex(json, "message", &jobj);
|
json_object_object_get_ex(json, "message", &jobj);
|
||||||
strncpy(jre->message, (char*) json_object_get_string(jobj), json_object_get_string_len(jobj));
|
strncpy(jre->message, (char*) json_object_get_string(jobj), json_object_get_string_len(jobj));
|
||||||
|
|
||||||
json_tokener_free(jt);
|
finalize_it:
|
||||||
json_object_put(json);
|
if(jt != NULL)
|
||||||
|
json_tokener_free(jt);
|
||||||
|
if(json != NULL)
|
||||||
|
json_object_put(json);
|
||||||
|
RETiRet;
|
||||||
|
}
|
||||||
|
|
||||||
return RS_RET_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user