kernel/util: Clear list links on removal under KDEBUG.
This way, if someone tries to double-remove an item or do other invalid things to it, this will crash instead of (silently) corrupting.
This commit is contained in:
parent
2393d22cdb
commit
ff6e777d28
|
@ -528,6 +528,10 @@ DOUBLY_LINKED_LIST_CLASS_NAME::Remove(Element* element)
|
|||
sGetLink(elLink->next)->previous = elLink->previous;
|
||||
else
|
||||
fLast = elLink->previous;
|
||||
|
||||
#if DEBUG_DOUBLY_LINKED_LIST
|
||||
elLink->next = elLink->previous = NULL;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -76,9 +76,13 @@ void
|
|||
list_remove_link(void *_link)
|
||||
{
|
||||
list_link *link = (list_link *)_link;
|
||||
|
||||
|
||||
link->next->prev = link->prev;
|
||||
link->prev->next = link->next;
|
||||
|
||||
#if DEBUG_DOUBLY_LINKED_LIST
|
||||
link->prev = link->next = NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue