Skip to content

Commit

Permalink
fix: fix unexpected fault address error(#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
vimiix committed Sep 20, 2024
1 parent 1123748 commit 48eb405
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ssx/bbolt/bbolt.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ func (r *Repo) GetMetadata(key []byte) ([]byte, error) {
var res []byte
lg.Debug("bbolt repo: get metadata: %s", string(key))
_ = r.db.View(func(tx *bbolt.Tx) error {
res = tx.Bucket(r.metaBucket).Get(key)
v := tx.Bucket(r.metaBucket).Get(key)
res = make([]byte, len(v))
// 'v' is only valid for the life of the transaction
copy(res, v)
return nil
})
return res, nil
Expand Down

0 comments on commit 48eb405

Please sign in to comment.