[client] Fix nil pointer panic in device and engine code (#5287)

This commit is contained in:
Viktor Liu
2026-02-12 16:15:42 +08:00
committed by GitHub
parent 2de1949018
commit 1ddc9ce2bf
4 changed files with 23 additions and 5 deletions

View File

@@ -82,7 +82,9 @@ func (t *TunNetstackDevice) create() (WGConfigurer, error) {
t.configurer = configurer.NewUSPConfigurer(t.device, t.name, t.bind.ActivityRecorder())
err = t.configurer.ConfigureInterface(t.key, t.port)
if err != nil {
_ = tunIface.Close()
if cErr := tunIface.Close(); cErr != nil {
log.Debugf("failed to close tun device: %v", cErr)
}
return nil, fmt.Errorf("error configuring interface: %s", err)
}