[asterisk-commits] bbryant: trunk r123575 - /trunk/main/astobj2.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jun 17 17:24:46 CDT 2008


Author: bbryant
Date: Tue Jun 17 17:24:45 2008
New Revision: 123575

URL: http://svn.digium.com/view/asterisk?view=rev&rev=123575
Log:
Revert a previous regression in astobj2.c from merging a branch.

Modified:
    trunk/main/astobj2.c

Modified: trunk/main/astobj2.c
URL: http://svn.digium.com/view/asterisk/trunk/main/astobj2.c?view=diff&rev=123575&r1=123574&r2=123575
==============================================================================
--- trunk/main/astobj2.c (original)
+++ trunk/main/astobj2.c Tue Jun 17 17:24:45 2008
@@ -930,6 +930,12 @@
 		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");




More information about the asterisk-commits mailing list