]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
lib:ldb: Use tdb_parse_record() in ldb_kv_sub_transaction_traverse()
authorAndreas Schneider <asn@samba.org>
Thu, 2 May 2024 13:15:43 +0000 (15:15 +0200)
committerVolker Lendecke <vl@samba.org>
Thu, 26 Sep 2024 08:46:29 +0000 (08:46 +0000)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
lib/ldb/ldb_key_value/ldb_kv_index.c

index 6a265166e1d4b922bc2291ae809b5768c7cba2e5..cbc594e545716bf619d3691e2ec867f2aaa70b4b 100644 (file)
@@ -3888,6 +3888,9 @@ static int ldb_kv_sub_transaction_traverse(
        TDB_DATA rec = {0};
        struct dn_list *index_in_subtransaction = NULL;
        struct dn_list *index_in_top_level = NULL;
+       struct ldb_dn_list_state sub_state = {
+               .module = module,
+       };
        int ret = 0;
 
        /*
@@ -3908,10 +3911,12 @@ static int ldb_kv_sub_transaction_traverse(
         * The TDB and so the fetched rec contains NO DATA, just a
         * pointer to data held in memory.
         */
-       rec = tdb_fetch(ldb_kv->idxptr->itdb, key);
-       if (rec.dptr != NULL) {
-               index_in_top_level = ldb_kv_index_idxptr(module, rec);
-               free(rec.dptr);
+       ret = tdb_parse_record(ldb_kv->idxptr->itdb,
+                              key,
+                              ldb_kv_index_idxptr_wrapper,
+                              &sub_state);
+       if (ret == 0) {
+               index_in_top_level = sub_state.list;
                if (index_in_top_level == NULL) {
                        abort();
                }