Fix leaking file descriptor in NetNs strategy

Docker-DCO-1.1-Signed-off-by: Hugo Duncan <hugo@hugoduncan.org> (github: hugoduncan)
This commit is contained in:
Hugo Duncan 2014-09-25 13:04:50 -04:00
parent 605edd6394
commit 52f4743aba
1 changed files with 2 additions and 0 deletions

View File

@ -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
}