mirror of
https://github.com/nmap/nmap.git
synced 2025-12-31 20:09:02 +00:00
Paranoid gh_list check: node is in list before removal
This commit is contained in:
@@ -210,6 +210,15 @@ static inline gh_lnode_t *gh_list_pop(gh_list_t *list) {
|
||||
static inline int gh_list_remove(gh_list_t *list, gh_lnode_t *lnode) {
|
||||
paranoid_list_check(list);
|
||||
|
||||
#if GH_LIST_PARANOID
|
||||
gh_lnode_t *cur;
|
||||
for (cur = list->first; cur != list->last; cur = cur->next) {
|
||||
if (cur == lnode)
|
||||
break;
|
||||
}
|
||||
assert(cur == lnode);
|
||||
#endif
|
||||
|
||||
if (lnode->prev) {
|
||||
lnode->prev->next = lnode->next;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user