[asterisk-commits] rizzo: branch rizzo/astobj2 r47531 - /team/rizzo/astobj2/main/astobj2.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Mon Nov 13 00:45:49 MST 2006


Author: rizzo
Date: Mon Nov 13 01:45:48 2006
New Revision: 47531

URL: http://svn.digium.com/view/asterisk?view=rev&rev=47531
Log:
of course, better not dereference an object after freeing it...


Modified:
    team/rizzo/astobj2/main/astobj2.c

Modified: team/rizzo/astobj2/main/astobj2.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/astobj2/main/astobj2.c?view=diff&rev=47531&r1=47530&r2=47531
==============================================================================
--- team/rizzo/astobj2/main/astobj2.c (original)
+++ team/rizzo/astobj2/main/astobj2.c Mon Nov 13 01:45:48 2006
@@ -450,8 +450,8 @@
 				cur = cur->next ;	/* prepare for next cycle */
 				/* update number of elements and version */
 				ast_atomic_fetchadd_int(&c->elements, -1);
+				ao2_ref(EXTERNAL_OBJ(x->astobj), -1);
 				free(x);	/* free the link record */
-				ao2_ref(EXTERNAL_OBJ(cur->astobj), -1);
 			} else {	/* prepare for next cycle */
 				prev = cur;
 				cur = cur->next;



More information about the asterisk-commits mailing list