memory issue is not impoved yet. json_object_free attempts to free memory twice