util: clear pointers on wl_list_remove()
authorPekka Paalanen <ppaalanen@gmail.com>
Wed, 9 Nov 2011 14:27:07 +0000 (16:27 +0200)
committerPekka Paalanen <ppaalanen@gmail.com>
Tue, 29 Nov 2011 12:46:49 +0000 (14:46 +0200)
Set the next and prev pointers of the removed list element to NULL. This
will catch programming errors that would use invalid list pointers,
double-remove for instance.

It also helps debugging, making it easy to see in gdb if an object is
not in a list.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
src/wayland-util.c

index 647b861..06bd245 100644 (file)
@@ -49,6 +49,8 @@ wl_list_remove(struct wl_list *elm)
 {
        elm->prev->next = elm->next;
        elm->next->prev = elm->prev;
+       elm->next = NULL;
+       elm->prev = NULL;
 }
 
 WL_EXPORT int