[asterisk-commits] branch 1.2 - r7429 /branches/1.2/include/asterisk/linkedlists.h

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Sat Dec 10 19:26:52 CST 2005


Author: tilghman
Date: Sat Dec 10 19:26:51 2005
New Revision: 7429

URL: http://svn.digium.com/view/asterisk?rev=7429&view=rev
Log:
Bug 5965 - major bug in AST_LIST_REMOVE

Modified:
    branches/1.2/include/asterisk/linkedlists.h

Modified: branches/1.2/include/asterisk/linkedlists.h
URL: http://svn.digium.com/view/asterisk/branches/1.2/include/asterisk/linkedlists.h?rev=7429&r1=7428&r2=7429&view=diff
==============================================================================
--- branches/1.2/include/asterisk/linkedlists.h (original)
+++ branches/1.2/include/asterisk/linkedlists.h Sat Dec 10 19:26:51 2005
@@ -424,15 +424,16 @@
 #define AST_LIST_REMOVE(head, elm, field) do {			        \
 	if ((head)->first == (elm)) {					\
 		(head)->first = (elm)->field.next;			\
-	}								\
-	else {								\
+		if ((head)->last = (elm))			\
+			(head)->last = NULL;			\
+	} else {								\
 		typeof(elm) curelm = (head)->first;			\
 		while (curelm->field.next != (elm))			\
 			curelm = curelm->field.next;			\
 		curelm->field.next = (elm)->field.next;			\
+		if ((head)->last == curelm->field.next)			\
+			(head)->last = curelm;				\
 	}								\
-	if ((head)->last == elm)					\
-		(head)->last = NULL;					\
 } while (0)
 
 #endif /* _ASTERISK_LINKEDLISTS_H */



More information about the asterisk-commits mailing list