If we're adding an element that's not null or not a freshly initialized list,
chances are we haven't removed it from a previous list.

Signed-off-by: Peter Hutterer <[email protected]>
---
 src/libinput-util.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/libinput-util.c b/src/libinput-util.c
index 48cb7181..93d73827 100644
--- a/src/libinput-util.c
+++ b/src/libinput-util.c
@@ -52,6 +52,8 @@ list_insert(struct list *list, struct list *elm)
 {
        assert((list->next != NULL && list->prev != NULL) ||
               !"list->next|prev is NULL, possibly missing list_init()");
+       assert(((elm->next == NULL && elm->prev == NULL) || list_empty(elm)) ||
+              !"elm->next|prev is not NULL, list node used twice?");
 
        elm->prev = list;
        elm->next = list->next;
-- 
2.13.6

_______________________________________________
wayland-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to