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
6b77259e11
commit
6277537cb3
@ -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