Skip to content

Commit

Permalink
namespace resource should be close after alloca success.
Browse files Browse the repository at this point in the history
  • Loading branch information
swapwz committed Dec 5, 2017
1 parent f47db0b commit d4ce146
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/veth/veth.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,11 @@ func JoinNetNS(name string, nspath string) error {
// move link to specified namespace
if nspath != "" {
netns, err := ns.GetNS(nspath)
defer netns.Close()
if err != nil {
fmt.Fprintf(os.Stderr, "[UNION CNI] failed to open netns %q: %v\r\n", nspath, err)
return err
}
defer netns.Close()
if err := netlink.LinkSetNsFd(link, int(netns.Fd())); err != nil {
fmt.Fprintf(os.Stderr, "[UNION CNI] failed to move link %q to netns: %v\r\n", name, err)
return err
Expand Down

0 comments on commit d4ce146

Please sign in to comment.