summaryrefslogtreecommitdiff
path: root/res/ari
diff options
context:
space:
mode:
Diffstat (limited to 'res/ari')
-rw-r--r--res/ari/resource_bridges.c1
-rw-r--r--res/ari/resource_channels.c5
-rw-r--r--res/ari/resource_endpoints.c3
3 files changed, 6 insertions, 3 deletions
diff --git a/res/ari/resource_bridges.c b/res/ari/resource_bridges.c
index ed3eba82e..16f26279b 100644
--- a/res/ari/resource_bridges.c
+++ b/res/ari/resource_bridges.c
@@ -682,6 +682,7 @@ void ast_ari_bridges_list(struct ast_variable *headers,
struct ast_json *json_bridge = ast_bridge_snapshot_to_json(snapshot, stasis_app_get_sanitizer());
if (!json_bridge || ast_json_array_append(json, json_bridge)) {
+ ao2_iterator_destroy(&i);
ast_ari_response_alloc_failed(response);
return;
}
diff --git a/res/ari/resource_channels.c b/res/ari/resource_channels.c
index 08ef15408..667ea73f0 100644
--- a/res/ari/resource_channels.c
+++ b/res/ari/resource_channels.c
@@ -663,8 +663,8 @@ void ast_ari_channels_list(struct ast_variable *headers,
return;
}
- for (i = ao2_iterator_init(snapshots, 0);
- (obj = ao2_iterator_next(&i)); ao2_cleanup(obj)) {
+ i = ao2_iterator_init(snapshots, 0);
+ while ((obj = ao2_iterator_next(&i))) {
RAII_VAR(struct stasis_message *, msg, obj, ao2_cleanup);
struct ast_channel_snapshot *snapshot = stasis_message_data(msg);
int r;
@@ -678,7 +678,6 @@ void ast_ari_channels_list(struct ast_variable *headers,
json, ast_channel_snapshot_to_json(snapshot, NULL));
if (r != 0) {
ast_ari_response_alloc_failed(response);
- ao2_cleanup(obj);
ao2_iterator_destroy(&i);
return;
}
diff --git a/res/ari/resource_endpoints.c b/res/ari/resource_endpoints.c
index c37f4968e..7dab25b9c 100644
--- a/res/ari/resource_endpoints.c
+++ b/res/ari/resource_endpoints.c
@@ -74,12 +74,14 @@ void ast_ari_endpoints_list(struct ast_variable *headers,
int r;
if (!json_endpoint) {
+ ao2_iterator_destroy(&i);
return;
}
r = ast_json_array_append(
json, json_endpoint);
if (r != 0) {
+ ao2_iterator_destroy(&i);
ast_ari_response_alloc_failed(response);
return;
}
@@ -144,6 +146,7 @@ void ast_ari_endpoints_list_by_tech(struct ast_variable *headers,
r = ast_json_array_append(
json, json_endpoint);
if (r != 0) {
+ ao2_iterator_destroy(&i);
ast_ari_response_alloc_failed(response);
return;
}