image: do actual RootFS.DiffIDs copying in Clone()
append(newRoot.DiffIDs) without element does nothing, so it's probably not what was intended. Changed code to perform a slice copying instead. Fixes #38834. Signed-off-by: Iskander Sharipov <quasilyte@gmail.com>
This commit is contained in:
parent
54dddadc7d
commit
3429e99930
|
@ -38,7 +38,8 @@ func (r *RootFS) Append(id layer.DiffID) {
|
||||||
func (r *RootFS) Clone() *RootFS {
|
func (r *RootFS) Clone() *RootFS {
|
||||||
newRoot := NewRootFS()
|
newRoot := NewRootFS()
|
||||||
newRoot.Type = r.Type
|
newRoot.Type = r.Type
|
||||||
newRoot.DiffIDs = append(r.DiffIDs)
|
newRoot.DiffIDs = make([]layer.DiffID, len(r.DiffIDs))
|
||||||
|
copy(newRoot.DiffIDs, r.DiffIDs)
|
||||||
return newRoot
|
return newRoot
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue