summaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorPaul Holzinger <paul.holzinger@web.de>2021-02-04 19:41:30 +0100
committerMatthew Heon <matthew.heon@pm.me>2021-02-05 13:50:48 -0500
commit951879c69045c893c15c3eb902a54115f0e28c18 (patch)
tree50ae0c1da7672863e5820ee9253be6be8cfe7445 /libpod
parent4793bf8ac2f01e9606233e0cfc49cad316921cb5 (diff)
downloadpodman-951879c69045c893c15c3eb902a54115f0e28c18.tar.gz
podman-951879c69045c893c15c3eb902a54115f0e28c18.tar.bz2
podman-951879c69045c893c15c3eb902a54115f0e28c18.zip
Fix podman network disconnect wrong NetworkStatus number
The allocated `tmpNetworkStatus` must be allocated with the length 0. Otherwise append would add new elements to the end of the slice and not at the beginning of the allocated memory. This caused inspect to fail since the number of networks did not matched the number of network statuses. Fixes #9234 Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
Diffstat (limited to 'libpod')
-rw-r--r--libpod/networking_linux.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/libpod/networking_linux.go b/libpod/networking_linux.go
index 2eabec634..9edea4fea 100644
--- a/libpod/networking_linux.go
+++ b/libpod/networking_linux.go
@@ -1168,7 +1168,7 @@ func (c *Container) NetworkDisconnect(nameOrID, netName string, force bool) erro
// update network status if container is not running
networkStatus := c.state.NetworkStatus
// clip out the index of the network
- tmpNetworkStatus := make([]*cnitypes.Result, len(networkStatus)-1)
+ tmpNetworkStatus := make([]*cnitypes.Result, 0, len(networkStatus)-1)
for k, v := range networkStatus {
if index != k {
tmpNetworkStatus = append(tmpNetworkStatus, v)