[PATCH] list.h: don't crash when removing an element from a NULL list

Peter Hutterer peter.hutterer at who-t.net
Wed Jul 4 23:17:56 PDT 2012


Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
Keith, please merge this directly if you're happy with it.

 include/list.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/list.h b/include/list.h
index 96c0bcb..d54a207 100644
--- a/include/list.h
+++ b/include/list.h
@@ -453,7 +453,7 @@ xorg_list_is_empty(struct xorg_list *head)
 #define nt_list_del(_entry, _list, _type, _member)		\
 	do {							\
 		_type *__e = _entry;				\
-		if (__e == NULL) break;				\
+		if (__e == NULL || _list == NULL) break;        \
 		if ((_list) == __e) {				\
 		    _list = __e->_member;			\
 		} else {					\
-- 
1.7.10.4



More information about the xorg-devel mailing list