Skip to content

Commit

Permalink
G601: Implicit memory aliasing in for loop
Browse files Browse the repository at this point in the history
    daemon/cluster/executor/container/adapter.go:446:42: G601: Implicit memory aliasing in for loop. (gosec)
            req := c.container.volumeCreateRequest(&mount)
                                                   ^
    daemon/network.go:577:10: G601: Implicit memory aliasing in for loop. (gosec)
                np := &n
                      ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
  • Loading branch information
thaJeztah committed Jun 10, 2021
1 parent d13997b commit b4c0c7c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions daemon/cluster/executor/container/adapter.go
Expand Up @@ -431,6 +431,7 @@ func (c *containerAdapter) remove(ctx context.Context) error {
func (c *containerAdapter) createVolumes(ctx context.Context) error {
// Create plugin volumes that are embedded inside a Mount
for _, mount := range c.container.task.Spec.GetContainer().Mounts {
mount := mount
if mount.Type != api.MountTypeVolume {
continue
}
Expand Down
6 changes: 3 additions & 3 deletions daemon/network.go
Expand Up @@ -573,9 +573,9 @@ func (daemon *Daemon) GetNetworks(filter filters.Args, config types.NetworkListC
}

if config.Detailed {
for i, n := range list {
np := &n
buildDetailedNetworkResources(np, idx[n.ID], config.Verbose)
for i := range list {
np := &list[i]
buildDetailedNetworkResources(np, idx[np.ID], config.Verbose)
list[i] = *np
}
}
Expand Down

0 comments on commit b4c0c7c

Please sign in to comment.