diff --git a/network/netns.go b/network/netns.go index 1ff75064..73cd8de5 100644 --- a/network/netns.go +++ b/network/netns.go @@ -30,8 +30,10 @@ func (v *NetNS) Initialize(config *Network, networkState *NetworkState) error { } if err := system.Setns(f.Fd(), syscall.CLONE_NEWNET); err != nil { + f.Close() return fmt.Errorf("failed to setns current network namespace: %v", err) } + f.Close() return nil }