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

Updates #1187

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick 2021-01-27 10:59:47 -08:00 committed by Brad Fitzpatrick
parent 9f5b0d058f
commit 4d943536f1

View File

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