Skip to content
Snippets Groups Projects
Commit 8a6febd9 authored by Jenkins2's avatar Jenkins2 Committed by Gerrit Code Review
Browse files

Merge "stasis_message_router: Remove silly usage of RAII_VAR."

parents 97a0e859 4b655184
No related branches found
No related tags found
No related merge requests found
...@@ -208,7 +208,7 @@ static struct stasis_message_router *stasis_message_router_create_internal( ...@@ -208,7 +208,7 @@ static struct stasis_message_router *stasis_message_router_create_internal(
struct stasis_topic *topic, int use_thread_pool) struct stasis_topic *topic, int use_thread_pool)
{ {
int res; int res;
RAII_VAR(struct stasis_message_router *, router, NULL, ao2_cleanup); struct stasis_message_router *router;
router = ao2_t_alloc(sizeof(*router), router_dtor, stasis_topic_name(topic)); router = ao2_t_alloc(sizeof(*router), router_dtor, stasis_topic_name(topic));
if (!router) { if (!router) {
...@@ -219,6 +219,8 @@ static struct stasis_message_router *stasis_message_router_create_internal( ...@@ -219,6 +219,8 @@ static struct stasis_message_router *stasis_message_router_create_internal(
res |= AST_VECTOR_INIT(&router->routes, 0); res |= AST_VECTOR_INIT(&router->routes, 0);
res |= AST_VECTOR_INIT(&router->cache_routes, 0); res |= AST_VECTOR_INIT(&router->cache_routes, 0);
if (res) { if (res) {
ao2_ref(router, -1);
return NULL; return NULL;
} }
...@@ -228,10 +230,11 @@ static struct stasis_message_router *stasis_message_router_create_internal( ...@@ -228,10 +230,11 @@ static struct stasis_message_router *stasis_message_router_create_internal(
router->subscription = stasis_subscribe(topic, router_dispatch, router); router->subscription = stasis_subscribe(topic, router_dispatch, router);
} }
if (!router->subscription) { if (!router->subscription) {
ao2_ref(router, -1);
return NULL; return NULL;
} }
ao2_ref(router, +1);
return router; return router;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment