From: Brett Bryant Date: Tue, 17 Jun 2008 22:24:45 +0000 (+0000) Subject: Revert a previous regression in astobj2.c from merging a branch. X-Git-Tag: 1.6.2.0-beta1~1958 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=99757cdb704a26d71d5ef273cf59cf6116169d20;p=thirdparty%2Fasterisk.git Revert a previous regression in astobj2.c from merging a branch. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@123575 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/main/astobj2.c b/main/astobj2.c index e9e2db7e5f..d8aaca1683 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");