summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgreen <green@FreeBSD.org>2000-12-30 16:10:32 +0000
committergreen <green@FreeBSD.org>2000-12-30 16:10:32 +0000
commit6277537cb346b049172c67f1cdcf25bfa56f6f93 (patch)
tree6882b48341c80e68072c82eed46cd271e51f0fc2
parent6b77259e1100507eb2e19d3fd8e94f9f557dec1b (diff)
downloadFreeBSD-src-6277537cb346b049172c67f1cdcf25bfa56f6f93.zip
FreeBSD-src-6277537cb346b049172c67f1cdcf25bfa56f6f93.tar.gz
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.
-rw-r--r--lib/libc/db/mpool/mpool.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/libc/db/mpool/mpool.c b/lib/libc/db/mpool/mpool.c
index 59ed4d3..a4ab912 100644
--- a/lib/libc/db/mpool/mpool.c
+++ b/lib/libc/db/mpool/mpool.c
@@ -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);
}
OpenPOWER on IntegriCloud