aboutsummaryrefslogtreecommitdiffstats
path: root/src/tun_linux.go
diff options
context:
space:
mode:
authorMathias Hall-Andersen <mathias@hall-andersen.dk>2017-07-18 14:15:29 +0200
committerMathias Hall-Andersen <mathias@hall-andersen.dk>2017-07-18 14:15:29 +0200
commitbd6027a4d5114df964e88e357b52883411174558 (patch)
tree617b6c4b8737d8a7834d2cfed2571016cad0d635 /src/tun_linux.go
parentFixed deadlock in index.go (diff)
downloadwireguard-go-bd6027a4d5114df964e88e357b52883411174558.tar.xz
wireguard-go-bd6027a4d5114df964e88e357b52883411174558.zip
Fixed file descriptor leak on linux
Diffstat (limited to 'src/tun_linux.go')
-rw-r--r--src/tun_linux.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/tun_linux.go b/src/tun_linux.go
index d0e9761..a200bd8 100644
--- a/src/tun_linux.go
+++ b/src/tun_linux.go
@@ -37,6 +37,8 @@ func (tun *NativeTun) setMTU(n int) error {
return err
}
+ defer syscall.Close(fd)
+
// do ioctl call
var ifr [64]byte
@@ -70,6 +72,8 @@ func (tun *NativeTun) MTU() (int, error) {
return 0, err
}
+ defer syscall.Close(fd)
+
// do ioctl call
var ifr [64]byte