Merge pull request #244 from thaJeztah/18.09_backport_fix_copying

[18.09 backport] image: do actual RootFS.DiffIDs copying in Clone()
This commit is contained in:
Andrew Hsu 2019-06-17 12:30:32 -07:00 committed by GitHub
commit 423f39ab05
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -38,7 +38,8 @@ func (r *RootFS) Append(id layer.DiffID) {
func (r *RootFS) Clone() *RootFS {
newRoot := NewRootFS()
newRoot.Type = r.Type
newRoot.DiffIDs = append(r.DiffIDs)
newRoot.DiffIDs = make([]layer.DiffID, len(r.DiffIDs))
copy(newRoot.DiffIDs, r.DiffIDs)
return newRoot
}