Merge pull request #2052 from tonistiigi/data-clone
commit
1ff1d00c42
|
@ -280,10 +280,13 @@ func (s *StorageItem) GetExternal(k string) ([]byte, error) {
|
||||||
if b == nil {
|
if b == nil {
|
||||||
return errors.WithStack(errNotFound)
|
return errors.WithStack(errNotFound)
|
||||||
}
|
}
|
||||||
dt = b.Get([]byte(k))
|
dt2 := b.Get([]byte(k))
|
||||||
if dt == nil {
|
if dt2 == nil {
|
||||||
return errors.WithStack(errNotFound)
|
return errors.WithStack(errNotFound)
|
||||||
}
|
}
|
||||||
|
// data needs to be copied as boltdb can reuse the buffer after View returns
|
||||||
|
dt = make([]byte, len(dt2))
|
||||||
|
copy(dt, dt2)
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue