Skip to content

Commit

Permalink
pkg/auth/badgerauth: fix replication logs not deleting correctly
Browse files Browse the repository at this point in the history
it.Item().Key() is not valid when used outside the scope of the
iteration, which in this case is txn.Delete().

Change-Id: I4491539ff567360fd1097383c4f0ec74b76c8a37
  • Loading branch information
halkyon committed Jun 12, 2022
1 parent 383cb6b commit 0d19072
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/auth/badgerauth/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ func deleteReplicationLogEntries(txn *badger.Txn, soughtKeyHash authdb.KeyHash)
}

if entry.KeyHash == soughtKeyHash {
if err := txn.Delete(it.Item().Key()); err != nil {
if err := txn.Delete(it.Item().KeyCopy(nil)); err != nil {
return err
}
}
Expand Down

0 comments on commit 0d19072

Please sign in to comment.