[asterisk-commits] trunk - r7428 /trunk/include/asterisk/linkedlists.h

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


Author: tilghman
Date: Sat Dec 10 19:26:09 2005
New Revision: 7428

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

Modified:
    trunk/include/asterisk/linkedlists.h

Modified: trunk/include/asterisk/linkedlists.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/linkedlists.h?rev=7428&r1=7427&r2=7428&view=diff
==============================================================================
--- trunk/include/asterisk/linkedlists.h (original)
+++ trunk/include/asterisk/linkedlists.h Sat Dec 10 19:26:09 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