summaryrefslogtreecommitdiff
path: root/res/ari
diff options
context:
space:
mode:
authorRichard Mudgett <rmudgett@digium.com>2014-02-21 18:04:54 +0000
committerRichard Mudgett <rmudgett@digium.com>2014-02-21 18:04:54 +0000
commitd277f3ec3ee7a7a38971f5da56bd79347ac6bf9a (patch)
tree500ce6ebba19b01725cdcda97108cdbb8b5fb557 /res/ari
parenteec8ccc10b9c88e0afb4504ed9a6074da06caaa9 (diff)
json: Fix off-nominal json ref counting issues.
* Fixed off-nominal json ref counting issue with using the following API calls: ast_json_object_set() and ast_json_array_append(). * Fixed off-nominal error reporting in ast_ari_endpoints_list(). * Fixed some miscellaneous off-nominal json ref counting issues in report_receive_fax_status() and dial_to_json(). ........ Merged revisions 408713 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@408714 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/ari')
-rw-r--r--res/ari/resource_endpoints.c10
1 files changed, 1 insertions, 9 deletions
diff --git a/res/ari/resource_endpoints.c b/res/ari/resource_endpoints.c
index 2f47b1a1a..16b7ebd8d 100644
--- a/res/ari/resource_endpoints.c
+++ b/res/ari/resource_endpoints.c
@@ -71,16 +71,8 @@ void ast_ari_endpoints_list(struct ast_variable *headers,
RAII_VAR(struct stasis_message *, msg, obj, ao2_cleanup);
struct ast_endpoint_snapshot *snapshot = stasis_message_data(msg);
struct ast_json *json_endpoint = ast_endpoint_snapshot_to_json(snapshot, stasis_app_get_sanitizer());
- int r;
- if (!json_endpoint) {
- ao2_iterator_destroy(&i);
- return;
- }
-
- r = ast_json_array_append(
- json, json_endpoint);
- if (r != 0) {
+ if (!json_endpoint || ast_json_array_append(json, json_endpoint)) {
ao2_iterator_destroy(&i);
ast_ari_response_alloc_failed(response);
return;