tdb_purge_dead can change the next pointer of "rec" if we purge the record
right behind the current record to be deleted. Just overwrite the magic,
not the whole record with stale data.
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
if (tdb->max_dead_records != 0) {
+ uint32_t magic = TDB_DEAD_MAGIC;
+
/*
* Allow for some dead records per hash chain, mainly for
* tdb's with a very high create/delete rate like locking.tdb.
/*
* Just mark the record as dead.
*/
- rec.magic = TDB_DEAD_MAGIC;
- ret = tdb_rec_write(tdb, rec_ptr, &rec);
+ ret = tdb_ofs_write(
+ tdb, rec_ptr + offsetof(struct tdb_record, magic),
+ &magic);
}
else {
ret = tdb_do_delete(tdb, rec_ptr, &rec);