]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
stasis: use ao2_t_alloc for certain object allocators
authorCorey Farrell <git@cfware.com>
Fri, 18 Jul 2014 19:53:31 +0000 (19:53 +0000)
committerCorey Farrell <git@cfware.com>
Fri, 18 Jul 2014 19:53:31 +0000 (19:53 +0000)
Add tags to stasis objects using the name.  This makes it
easier to track the source of certain stasis ref leaks.

Review: https://reviewboard.asterisk.org/r/3821/

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@418996 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/stasis.c
main/stasis_cache_pattern.c
main/stasis_message.c
main/stasis_message_router.c

index a451e7b134280638e4a4a0c5102667b491fd6f8a..594ec5e99c9641ea0e29269f4ea419219cf3a5a7 100644 (file)
@@ -204,7 +204,7 @@ struct stasis_topic *stasis_topic_create(const char *name)
        struct stasis_topic *topic;
        int res = 0;
 
-       topic = ao2_alloc(sizeof(*topic), topic_dtor);
+       topic = ao2_t_alloc(sizeof(*topic), topic_dtor, name);
        if (!topic) {
                return NULL;
        }
@@ -311,7 +311,7 @@ struct stasis_subscription *internal_stasis_subscribe(
        }
 
        /* The ao2 lock is used for join_cond. */
-       sub = ao2_alloc(sizeof(*sub), subscription_dtor);
+       sub = ao2_t_alloc(sizeof(*sub), subscription_dtor, topic->name);
        if (!sub) {
                return NULL;
        }
index 9644028c36d768c4282daa9ee74859413ef10134..9e3de367ad7c7bd4ace859268ed6f25cb731e568 100644 (file)
@@ -70,7 +70,7 @@ struct stasis_cp_all *stasis_cp_all_create(const char *name,
        RAII_VAR(char *, cached_name, NULL, ast_free);
        RAII_VAR(struct stasis_cp_all *, all, NULL, ao2_cleanup);
 
-       all = ao2_alloc(sizeof(*all), all_dtor);
+       all = ao2_t_alloc(sizeof(*all), all_dtor, name);
        if (!all) {
                return NULL;
        }
@@ -138,7 +138,7 @@ struct stasis_cp_single *stasis_cp_single_create(struct stasis_cp_all *all,
 {
        RAII_VAR(struct stasis_cp_single *, one, NULL, ao2_cleanup);
 
-       one = ao2_alloc(sizeof(*one), one_dtor);
+       one = ao2_t_alloc(sizeof(*one), one_dtor, name);
        if (!one) {
                return NULL;
        }
index 6132efc20d1f8c0fadd2f4c58a78f20f5ddd40e5..70c4085390cfa49b347e7a9ddcf4aaafb3802d1d 100644 (file)
@@ -55,7 +55,7 @@ struct stasis_message_type *stasis_message_type_create(const char *name,
 {
        struct stasis_message_type *type;
 
-       type = ao2_alloc(sizeof(*type), message_type_dtor);
+       type = ao2_t_alloc(sizeof(*type), message_type_dtor, name);
        if (!type) {
                return NULL;
        }
@@ -108,7 +108,7 @@ struct stasis_message *stasis_message_create_full(struct stasis_message_type *ty
                return NULL;
        }
 
-       message = ao2_alloc(sizeof(*message), stasis_message_dtor);
+       message = ao2_t_alloc(sizeof(*message), stasis_message_dtor, type->name);
        if (message == NULL) {
                return NULL;
        }
@@ -191,4 +191,4 @@ struct ast_json *stasis_message_to_json(
 struct ast_event *stasis_message_to_event(struct stasis_message *msg)
 {
        return INVOKE_VIRTUAL(to_event, msg);
-}
\ No newline at end of file
+}
index 41495db11f66fab2b18395293ec50077c796691c..900265e6c1ba7dbcd5796226bd6c8209fdbc7b9a 100644 (file)
@@ -212,7 +212,7 @@ struct stasis_message_router *stasis_message_router_create(
        int res;
        RAII_VAR(struct stasis_message_router *, router, NULL, ao2_cleanup);
 
-       router = ao2_alloc(sizeof(*router), router_dtor);
+       router = ao2_t_alloc(sizeof(*router), router_dtor, topic->name);
        if (!router) {
                return NULL;
        }