* include/grub/list.h (grub_list_remove): Don't crash if element is

removed twice.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2012-01-29 18:09:53 +01:00
parent ca8c0baf25
commit 87cf97447e
2 changed files with 9 additions and 1 deletions

View file

@ -1,3 +1,8 @@
2012-01-29 Vladimir Serbinenko <phcoder@gmail.com>
* include/grub/list.h (grub_list_remove): Don't crash if element is
removed twice.
2012-01-29 Vladimir Serbinenko <phcoder@gmail.com>
Rename ofconsole to console.

View file

@ -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)