Merge pull request #2052 from tonistiigi/data-clone

v0.9
Akihiro Suda 2021-04-01 10:54:23 +09:00 committed by GitHub
commit 1ff1d00c42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions

View File

@ -280,10 +280,13 @@ func (s *StorageItem) GetExternal(k string) ([]byte, error) {
if b == nil {
return errors.WithStack(errNotFound)
}
dt = b.Get([]byte(k))
if dt == nil {
dt2 := b.Get([]byte(k))
if dt2 == nil {
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
})
if err != nil {