mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-16 10:20:30 +00:00
Fix a tailq conversion bug that resulted in, e.g., nvi crashing upon
quitting every time. The way to free a CIRCLEQ was to loop until the current == current->head, but the way to free a TAILQ is to loop until current->head == NULL. In any case, the CORRECT way to do it is a loop of TAILQ_EMPTY() checks and TAILQ_REMOVE()al of TAILQ_FIRST(). This bug wouldn't have happened if the loop wasn't hard-coded... There may be more bugs of this type from the conversion.
This commit is contained in:
parent
26a2d90362
commit
429d49129b
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=70512
@ -271,7 +271,8 @@ mpool_close(mp)
|
||||
BKT *bp;
|
||||
|
||||
/* Free up any space allocated to the lru pages. */
|
||||
while ((bp = TAILQ_FIRST(&mp->lqh)) != (void *)&mp->lqh) {
|
||||
while (!TAILQ_EMPTY(&mp->lqh)) {
|
||||
bp = TAILQ_FIRST(&mp->lqh);
|
||||
TAILQ_REMOVE(&mp->lqh, bp, q);
|
||||
free(bp);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user