c8d/list: Initialize capacity instead of length
The slice which stores chain ids used for computing shared size was mistakenly initialized with the length set instead of the capacity. This caused a panic when iterating over it later and dereferncing nil pointer from empty items. Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
This commit is contained in:
parent
598c295707
commit
391f9635cc
1 changed files with 1 additions and 1 deletions
|
@ -61,7 +61,7 @@ func (i *ImageService) Images(ctx context.Context, opts types.ImageListOptions)
|
|||
layers map[digest.Digest]int
|
||||
)
|
||||
if opts.SharedSize {
|
||||
root = make([]*[]digest.Digest, len(imgs))
|
||||
root = make([]*[]digest.Digest, 0, len(imgs))
|
||||
layers = make(map[digest.Digest]int)
|
||||
}
|
||||
for n, img := range imgs {
|
||||
|
|
Loading…
Add table
Reference in a new issue