mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-27 10:09:43 -05:00
ITS#7230 check and strip 0 length IDLs from freelist
This commit is contained in:
parent
7ba25c488a
commit
de0cb27d70
1 changed files with 11 additions and 5 deletions
|
|
@ -1224,7 +1224,9 @@ mdb_page_alloc(MDB_cursor *mc, int num)
|
|||
last = *kptr;
|
||||
} else {
|
||||
MDB_val key;
|
||||
int rc, exact = 0;
|
||||
int rc, exact;
|
||||
again:
|
||||
exact = 0;
|
||||
last = txn->mt_env->me_pglast + 1;
|
||||
leaf = NULL;
|
||||
key.mv_data = &last;
|
||||
|
|
@ -1254,13 +1256,17 @@ mdb_page_alloc(MDB_cursor *mc, int num)
|
|||
if (!txn->mt_env->me_pgfirst) {
|
||||
mdb_node_read(txn, leaf, &data);
|
||||
}
|
||||
idl = (ID *) data.mv_data;
|
||||
mop = malloc(sizeof(MDB_oldpages) + MDB_IDL_SIZEOF(idl) - sizeof(pgno_t));
|
||||
mop->mo_next = txn->mt_env->me_pghead;
|
||||
mop->mo_txnid = last;
|
||||
txn->mt_env->me_pglast = last;
|
||||
if (!txn->mt_env->me_pgfirst)
|
||||
txn->mt_env->me_pgfirst = last;
|
||||
idl = (ID *) data.mv_data;
|
||||
/* We might have a zero-length IDL due to freelist growth
|
||||
* during a prior commit
|
||||
*/
|
||||
if (!idl[0]) goto again;
|
||||
mop = malloc(sizeof(MDB_oldpages) + MDB_IDL_SIZEOF(idl) - sizeof(pgno_t));
|
||||
mop->mo_next = txn->mt_env->me_pghead;
|
||||
mop->mo_txnid = last;
|
||||
txn->mt_env->me_pghead = mop;
|
||||
memcpy(mop->mo_pages, idl, MDB_IDL_SIZEOF(idl));
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue