]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
stasis_message_router: Remove silly usage of RAII_VAR.
authorCorey Farrell <git@cfware.com>
Tue, 9 Jan 2018 16:55:37 +0000 (11:55 -0500)
committerCorey Farrell <git@cfware.com>
Tue, 9 Jan 2018 16:55:37 +0000 (11:55 -0500)
Change-Id: I50d6ae230920e0b878ed9cc8f79eef746e06701d

main/stasis_message_router.c

index cf0ac787ed6d4ad72df7004b281517b18e36ed07..498ddd6c2f9f2ea51ff1c096efdd0b20076ad8c2 100644 (file)
@@ -210,7 +210,7 @@ static struct stasis_message_router *stasis_message_router_create_internal(
        struct stasis_topic *topic, int use_thread_pool)
 {
        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));
        if (!router) {
@@ -221,6 +221,8 @@ static struct stasis_message_router *stasis_message_router_create_internal(
        res |= AST_VECTOR_INIT(&router->routes, 0);
        res |= AST_VECTOR_INIT(&router->cache_routes, 0);
        if (res) {
+               ao2_ref(router, -1);
+
                return NULL;
        }
 
@@ -230,10 +232,11 @@ static struct stasis_message_router *stasis_message_router_create_internal(
                router->subscription = stasis_subscribe(topic, router_dispatch, router);
        }
        if (!router->subscription) {
+               ao2_ref(router, -1);
+
                return NULL;
        }
 
-       ao2_ref(router, +1);
        return router;
 }