summaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2021-11-22 16:01:40 -0500
committerGitHub <noreply@github.com>2021-11-22 16:01:40 -0500
commit3eb1453b80db2dfe75edc4705f23f542a7a0f426 (patch)
tree8253bdc3bf0aaeb70f4e3c18bd112851000560ce /libpod
parent0b7c132d9f42a00e31eb8dc5133946f83572a418 (diff)
parent044edbb9c9e798e1848682fa0e5389791296f2cb (diff)
downloadpodman-3eb1453b80db2dfe75edc4705f23f542a7a0f426.tar.gz
podman-3eb1453b80db2dfe75edc4705f23f542a7a0f426.tar.bz2
podman-3eb1453b80db2dfe75edc4705f23f542a7a0f426.zip
Merge pull request #12352 from Luap99/netavark-err
Fix netavark error handling and teardown issue
Diffstat (limited to 'libpod')
-rw-r--r--libpod/network/netavark/run.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/libpod/network/netavark/run.go b/libpod/network/netavark/run.go
index 54917a981..0ac20daee 100644
--- a/libpod/network/netavark/run.go
+++ b/libpod/network/netavark/run.go
@@ -55,7 +55,15 @@ func (n *netavarkNetwork) Setup(namespacePath string, options types.SetupOptions
result := map[string]types.StatusBlock{}
err = n.execNetavark([]string{"setup", namespacePath}, netavarkOpts, &result)
+ if err != nil {
+ // lets dealloc ips to prevent leaking
+ if err := n.deallocIPs(&options.NetworkOptions); err != nil {
+ logrus.Error(err)
+ }
+ return nil, err
+ }
+ // make sure that the result makes sense
if len(result) != len(options.Networks) {
logrus.Errorf("unexpected netavark result: %v", result)
return nil, fmt.Errorf("unexpected netavark result length, want (%d), got (%d) networks", len(options.Networks), len(result))