Zap next uid in clink_rem(), check it in clink_add()
The former ensures that next links are valid even for uids not on any list. The latter oopses on adding an uid to a list when it is already on a list, unless it is at the tail.
This commit is contained in:
parent
7441e2499f
commit
b10ebe6992
1 changed files with 2 additions and 0 deletions
|
@ -144,6 +144,7 @@ clink_add(struct clink *cl, int type, int uid)
|
||||||
return;
|
return;
|
||||||
if (CANT_HAPPEN(*head >= nclink[type]))
|
if (CANT_HAPPEN(*head >= nclink[type]))
|
||||||
*head = -1;
|
*head = -1;
|
||||||
|
CANT_HAPPEN(clink[type][uid].next >= 0);
|
||||||
clink[type][uid].next = *head;
|
clink[type][uid].next = *head;
|
||||||
*head = uid;
|
*head = uid;
|
||||||
}
|
}
|
||||||
|
@ -171,6 +172,7 @@ clink_rem(struct clink *cl, int type, int uid)
|
||||||
}
|
}
|
||||||
|
|
||||||
*p = linkv[uid].next;
|
*p = linkv[uid].next;
|
||||||
|
linkv[uid].next = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue