From 502f024e7c1d4eb324ce5b620dbb977ba2ff6cae Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Thu, 16 May 2024 19:28:50 +0300 Subject: [PATCH] storage: bytes.Clone(nil) == nil Signed-off-by: Roman Khimov --- pkg/core/storage/boltdb_store.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/pkg/core/storage/boltdb_store.go b/pkg/core/storage/boltdb_store.go index f313dcd2e1..3495f6d24d 100644 --- a/pkg/core/storage/boltdb_store.go +++ b/pkg/core/storage/boltdb_store.go @@ -77,11 +77,8 @@ func NewBoltDBStore(cfg dbconfig.BoltDBOptions) (*BoltDBStore, error) { func (s *BoltDBStore) Get(key []byte) (val []byte, err error) { err = s.db.View(func(tx *bbolt.Tx) error { b := tx.Bucket(Bucket) - val = b.Get(key) // Value from Get is only valid for the lifetime of transaction, #1482 - if val != nil { - val = bytes.Clone(val) - } + val = bytes.Clone(b.Get(key)) return nil }) if val == nil {