Fixed file descriptor leak on linux

This commit is contained in:
Mathias Hall-Andersen
2017-07-18 14:15:29 +02:00
parent c5d7efc246
commit bd6027a4d5
2 changed files with 6 additions and 4 deletions

View File

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