diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-02-27 02:20:17 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-02-27 04:11:41 +0100 |
commit | 971be13e773f133a0a5ab08957725b43452202e2 (patch) | |
tree | 7ced4d8fd1ac4d97c3d528c995f013da4c904b8d /tun/tun_linux.go | |
parent | 366cbd11a40a6a3fde5d0dc803ca6895859ed188 (diff) |
tun: linux: netlink sock needs cleaning up but file will be gc'd
Diffstat (limited to 'tun/tun_linux.go')
-rw-r--r-- | tun/tun_linux.go | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/tun/tun_linux.go b/tun/tun_linux.go index 8dcad6b..0ee9f6c 100644 --- a/tun/tun_linux.go +++ b/tun/tun_linux.go @@ -390,7 +390,6 @@ func CreateTUNFromFile(file *os.File, mtu int) (TUNDevice, error) { _, err = tun.Name() if err != nil { - tun.tunFile.Close() return nil, err } @@ -403,12 +402,11 @@ func CreateTUNFromFile(file *os.File, mtu int) (TUNDevice, error) { tun.netlinkSock, err = createNetlinkSocket() if err != nil { - tun.tunFile.Close() return nil, err } tun.netlinkCancel, err = rwcancel.NewRWCancel(tun.netlinkSock) if err != nil { - tun.tunFile.Close() + unix.Close(tun.netlinkSock) return nil, err } @@ -418,7 +416,7 @@ func CreateTUNFromFile(file *os.File, mtu int) (TUNDevice, error) { err = tun.setMTU(mtu) if err != nil { - tun.Close() + unix.Close(tun.netlinkSock) return nil, err } |