私はJSON-Cを初めて使用しています。私のサンプルコードを見てください。JSON-Cを使用したメモリリーク
struct json_object *new_obj = NULL;
new_obj = json_tokener_parse(strRawJSON);
new_obj = json_object_object_get(new_obj, "FUU");
if(NULL == new_obj){
SYS_OUT("\nFUU not found in JSON");
return NO;
}
new_obj = json_object_object_get(new_obj, "FOO"); // I m re-using new_obj, without free it?
if(NULL == new_obj){
SYS_OUT("\nFOO not found in JSON");
return NO;
}
// DO I need to clean new_obj, if yes then how ??
new_objを削除する必要がありますか?いくつかの方法でJSON-Cのメモリ管理の仕方を理解することができます。アドバンス
JSON-Cが参照カウントを使用して 'json_object'インスタンスを管理し、インスタンスを解放するために使用される関数が[json_object_put](http://oss.metaparadigm.com/json- c/doc/html/json__object_8h.html#a15)。 – hmjd