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>
| ... | ... |
@@ -38,7 +38,8 @@ func (r *RootFS) Append(id layer.DiffID) {
|
| 38 | 38 |
func (r *RootFS) Clone() *RootFS {
|
| 39 | 39 |
newRoot := NewRootFS() |
| 40 | 40 |
newRoot.Type = r.Type |
| 41 |
- newRoot.DiffIDs = append(r.DiffIDs) |
|
| 41 |
+ newRoot.DiffIDs = make([]layer.DiffID, len(r.DiffIDs)) |
|
| 42 |
+ copy(newRoot.DiffIDs, r.DiffIDs) |
|
| 42 | 43 |
return newRoot |
| 43 | 44 |
} |
| 44 | 45 |
|