aboutsummaryrefslogtreecommitdiffstats
path: root/main/astobj2.c
diff options
context:
space:
mode:
authorbbryant <bbryant@f38db490-d61c-443f-a65b-d21fe96a405b>2008-06-17 22:24:45 +0000
committerbbryant <bbryant@f38db490-d61c-443f-a65b-d21fe96a405b>2008-06-17 22:24:45 +0000
commitbf03be75ff0788ecfabc88388b535940e69514c2 (patch)
tree358da2db11e714f9cd3e86298b7f1217aff7efb2 /main/astobj2.c
parent720a492e88bee291ee8afa7559b6c0a30e205661 (diff)
Revert a previous regression in astobj2.c from merging a branch.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@123575 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/astobj2.c')
-rw-r--r--main/astobj2.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/main/astobj2.c b/main/astobj2.c
index e9e2db7e5..d8aaca168 100644
--- a/main/astobj2.c
+++ b/main/astobj2.c
@@ -930,6 +930,12 @@ static char *handle_astobj2_test(struct ast_cli_entry *e, int cmd, struct ast_cl
ast_cli(a->fd, "object %d allocated as %p\n", i, obj);
sprintf(obj, "-- this is obj %d --", i);
ao2_link(c1, obj);
+ /* At this point, the refcount on obj is 2 due to the allocation
+ * and linking. We can go ahead and reduce the refcount by 1
+ * right here so that when the container is unreffed later, the
+ * objects will be freed
+ */
+ ao2_t_ref(obj, -1, "test");
}
ast_cli(a->fd, "testing callbacks\n");
ao2_t_callback(c1, 0, print_cb, &a->fd,"test callback");