store/file: fix segmentation violation bug (#2013)
This commit is contained in:
parent
99ba8dd7d4
commit
5469df1d7b
9
blob.go
9
blob.go
@ -59,11 +59,16 @@ func (b *blobStore) Read(key string, opts ...store.BlobOption) (io.Reader, error
|
||||
}
|
||||
|
||||
// look for the blob within the bucket
|
||||
value = bucket.Get([]byte(key))
|
||||
if value == nil {
|
||||
res := bucket.Get([]byte(key))
|
||||
if res == nil {
|
||||
return store.ErrNotFound
|
||||
}
|
||||
|
||||
// the res object is only valid for the duration of the blot transaction, see:
|
||||
// https://github.com/golang/go/issues/33047
|
||||
value = make([]byte, len(res))
|
||||
copy(value, res)
|
||||
|
||||
return nil
|
||||
}
|
||||
if err := db.View(readValue); err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user