wgengine: don't leak TUN device in NewUserspaceEngine error path

Updates #1187

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
pull/1219/head
Brad Fitzpatrick 2021-01-27 10:59:47 -08:00 committed by Brad Fitzpatrick
parent 9f5b0d058f
commit 4d943536f1
1 changed files with 1 additions and 0 deletions

View File

@ -194,6 +194,7 @@ func NewUserspaceEngine(logf logger.Logf, tunname string, listenPort uint16) (En
e, err := NewUserspaceEngineAdvanced(conf)
if err != nil {
tun.Close()
return nil, err
}
return e, err