From: Vladimir 'phcoder' Serbinenko Date: Sun, 29 Jan 2012 17:09:53 +0000 (+0100) Subject: * include/grub/list.h (grub_list_remove): Don't crash if element is X-Git-Tag: 2.00~753 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=87cf97447e842fd949ecf6ccba97e210df1f2d4f;p=thirdparty%2Fgrub.git * include/grub/list.h (grub_list_remove): Don't crash if element is removed twice. --- diff --git a/ChangeLog b/ChangeLog index e2677e46e..d58220b12 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2012-01-29 Vladimir Serbinenko + + * include/grub/list.h (grub_list_remove): Don't crash if element is + removed twice. + 2012-01-29 Vladimir Serbinenko Rename ofconsole to console. diff --git a/include/grub/list.h b/include/grub/list.h index 6629b2c19..54f528a05 100644 --- a/include/grub/list.h +++ b/include/grub/list.h @@ -44,9 +44,12 @@ grub_list_push (grub_list_t *head, grub_list_t item) static inline void grub_list_remove (grub_list_t item) { - *item->prev = item->next; + if (item->prev) + *item->prev = item->next; if (item->next) item->next->prev = item->prev; + item->next = 0; + item->prev = 0; } #define FOR_LIST_ELEMENTS(var, list) for ((var) = (list); (var); (var) = (var)->next)