summaryrefslogtreecommitdiff
path: root/main/stasis.c
diff options
context:
space:
mode:
Diffstat (limited to 'main/stasis.c')
-rw-r--r--main/stasis.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/main/stasis.c b/main/stasis.c
index a82e938f4..4a5d8ac7c 100644
--- a/main/stasis.c
+++ b/main/stasis.c
@@ -908,7 +908,7 @@ struct stasis_forward *stasis_forward_all(struct stasis_topic *from_topic,
{
int res;
size_t idx;
- RAII_VAR(struct stasis_forward *, forward, NULL, ao2_cleanup);
+ struct stasis_forward *forward;
if (!from_topic || !to_topic) {
return NULL;
@@ -921,7 +921,7 @@ struct stasis_forward *stasis_forward_all(struct stasis_topic *from_topic,
/* Forwards to ourselves are implicit. */
if (to_topic == from_topic) {
- return ao2_bump(forward);
+ return forward;
}
forward->from_topic = ao2_bump(from_topic);
@@ -932,6 +932,7 @@ struct stasis_forward *stasis_forward_all(struct stasis_topic *from_topic,
if (res != 0) {
ao2_unlock(from_topic);
ao2_unlock(to_topic);
+ ao2_ref(forward, -1);
return NULL;
}
@@ -941,7 +942,7 @@ struct stasis_forward *stasis_forward_all(struct stasis_topic *from_topic,
ao2_unlock(from_topic);
ao2_unlock(to_topic);
- return ao2_bump(forward);
+ return forward;
}
static void subscription_change_dtor(void *obj)
@@ -1342,7 +1343,7 @@ static struct ast_str *multi_object_blob_to_ami(void *obj)
for (type = 0; type < STASIS_UMOS_MAX; ++type) {
for (i = 0; i < AST_VECTOR_SIZE(&multi->snapshots[type]); ++i) {
- char *name = "";
+ char *name = NULL;
void *snapshot = AST_VECTOR_GET(&multi->snapshots[type], i);
ami_snapshot = NULL;
@@ -1352,11 +1353,11 @@ static struct ast_str *multi_object_blob_to_ami(void *obj)
switch (type) {
case STASIS_UMOS_CHANNEL:
- ami_snapshot = ast_manager_build_channel_state_string_prefix(snapshot, name);
+ ami_snapshot = ast_manager_build_channel_state_string_prefix(snapshot, name ?: "");
break;
case STASIS_UMOS_BRIDGE:
- ami_snapshot = ast_manager_build_bridge_state_string_prefix(snapshot, name);
+ ami_snapshot = ast_manager_build_bridge_state_string_prefix(snapshot, name ?: "");
break;
case STASIS_UMOS_ENDPOINT:
@@ -1367,6 +1368,7 @@ static struct ast_str *multi_object_blob_to_ami(void *obj)
ast_str_append(&ami_str, 0, "%s", ast_str_buffer(ami_snapshot));
ast_free(ami_snapshot);
}
+ ast_free(name);
}
}