From 52f4743aba95c0939ccc134534e4a968b05610f9 Mon Sep 17 00:00:00 2001 From: Hugo Duncan Date: Thu, 25 Sep 2014 13:04:50 -0400 Subject: [PATCH] Fix leaking file descriptor in NetNs strategy Docker-DCO-1.1-Signed-off-by: Hugo Duncan (github: hugoduncan) --- network/netns.go | 2 ++ 1 file changed, 2 insertions(+) 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 }