ITS#10302 slapd-mdb: fix idcursor double-free in slapadd shutdown

Caused when calling tool_entry_modify to update ctxcsn after all adds are done.
This commit is contained in:
Howard Chu 2025-02-04 17:00:36 +00:00
parent 002214cc38
commit 429556c5f6

View file

@ -1051,7 +1051,7 @@ ID mdb_tool_entry_modify(
op.o_tmpmfuncs = &ch_mfuncs;
/* id2entry index */
rc = mdb_id2entry_update( &op, mdb_tool_txn, NULL, e );
rc = mdb_id2entry_update( &op, mdb_tool_txn, idcursor, e );
if( rc != 0 ) {
snprintf( text->bv_val, text->bv_len,
"id2entry_update failed: err=%d", rc );
@ -1086,6 +1086,7 @@ done:
e->e_id = NOID;
}
mdb_tool_txn = NULL;
idcursor = NULL;
return e->e_id;
}