]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
ITS#10302 slapd-mdb: fix idcursor double-free in slapadd shutdown
authorHoward Chu <hyc@openldap.org>
Tue, 4 Feb 2025 17:00:36 +0000 (17:00 +0000)
committerHoward Chu <hyc@openldap.org>
Tue, 4 Feb 2025 17:00:36 +0000 (17:00 +0000)
Caused when calling tool_entry_modify to update ctxcsn after all adds are done.

servers/slapd/back-mdb/tools.c

index 2a94147ec5d8a2aff250e0706be6ac08a75435b4..6ea63bbb54bbc060e32c4278956be570e827373c 100644 (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;
 }