From 3394a3ef239406720a23b03e19d0a2134e337f40 Mon Sep 17 00:00:00 2001 From: fros4943 Date: Mon, 22 Mar 2010 11:29:58 +0000 Subject: [PATCH] make sure not to add an already existing list element, as it breaks the list iteration functions --- core/lib/list.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/lib/list.c b/core/lib/list.c index 3cf43a27f..d94ae27e1 100644 --- a/core/lib/list.c +++ b/core/lib/list.c @@ -43,7 +43,7 @@ * * Author: Adam Dunkels * - * $Id: list.c,v 1.2 2008/12/16 09:59:42 joxe Exp $ + * $Id: list.c,v 1.3 2010/03/22 11:29:58 fros4943 Exp $ */ #include "lib/list.h" @@ -144,6 +144,9 @@ list_add(list_t list, void *item) { struct list *l; + /* Make sure not to add the same element twice */ + list_remove(list, item); + ((struct list *)item)->next = NULL; l = list_tail(list);