Browse code

integration-cli: inspectMountPoint: fix implicit memory aliasing (gosec)

integration-cli/docker_utils_test.go:149:8: G601: Implicit memory aliasing in for loop. (gosec)
m = &c
^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Sebastiaan van Stijn authored on 2024/11/06 01:39:12
Showing 1 changed files
... ...
@@ -143,19 +143,13 @@ func inspectMountPoint(name, destination string) (container.MountPoint, error) {
143 143
 		return container.MountPoint{}, err
144 144
 	}
145 145
 
146
-	var m *container.MountPoint
147 146
 	for _, c := range mp {
148 147
 		if c.Destination == destination {
149
-			m = &c
150
-			break
148
+			return c, nil
151 149
 		}
152 150
 	}
153 151
 
154
-	if m == nil {
155
-		return container.MountPoint{}, errMountNotFound
156
-	}
157
-
158
-	return *m, nil
152
+	return container.MountPoint{}, errMountNotFound
159 153
 }
160 154
 
161 155
 func getIDByName(c *testing.T, name string) string {