diff options
author | Martin Hedenfal <martinh@cvs.openbsd.org> | 2010-06-30 21:44:34 +0000 |
---|---|---|
committer | Martin Hedenfal <martinh@cvs.openbsd.org> | 2010-06-30 21:44:34 +0000 |
commit | 2e91bffb2abb266e76f1bb68bbbf49cae4dada5c (patch) | |
tree | 873eb00d220d59ead276727571a84c4a05a4c0c2 /usr.sbin/ldapd/btree.c | |
parent | 6cd9b9851aa258e108a23fb8fca4e4bcd996fdbf (diff) |
Don't prune page cache directly when adding to it. Fixes a crash with a
zero cache-size.
found by william@
Diffstat (limited to 'usr.sbin/ldapd/btree.c')
-rw-r--r-- | usr.sbin/ldapd/btree.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.sbin/ldapd/btree.c b/usr.sbin/ldapd/btree.c index d1dce42cf71..b9e484bfdd5 100644 --- a/usr.sbin/ldapd/btree.c +++ b/usr.sbin/ldapd/btree.c @@ -1,4 +1,4 @@ -/* $OpenBSD: btree.c,v 1.15 2010/06/29 04:27:15 martinh Exp $ */ +/* $OpenBSD: btree.c,v 1.16 2010/06/30 21:44:33 martinh Exp $ */ /* * Copyright (c) 2009, 2010 Martin Hedenfalk <martin@bzero.se> @@ -486,7 +486,6 @@ mpage_add(struct btree *bt, struct mpage *mp) assert(RB_INSERT(page_cache, bt->page_cache, mp) == NULL); bt->stat.cache_size++; TAILQ_INSERT_TAIL(bt->lru_queue, mp, lru_next); - mpage_prune(bt); } static void @@ -3033,6 +3032,7 @@ btree_compact_tree(struct btree *bt, pgno_t pgno, struct btree *btc) free(p); if (rc != (ssize_t)bt->head.psize) return P_INVALID; + mpage_prune(bt); return pgno; } @@ -3095,6 +3095,7 @@ btree_compact(struct btree *bt) btree_txn_abort(txnc); free(compact_path); btree_close(btc); + mpage_prune(bt); return 0; failed: @@ -3103,6 +3104,7 @@ failed: unlink(compact_path); free(compact_path); btree_close(btc); + mpage_prune(bt); return BT_FAIL; } |