mirror of
https://github.com/netbirdio/netbird.git
synced 2025-02-22 21:21:23 +01:00
Fix nil pointer exception in error handling (#696)
In case if the wgctrl.New() return with err, should not close the resource.
This commit is contained in:
parent
2f0b652dad
commit
c3ed08c249
@ -127,12 +127,10 @@ func interfaceFilter(blackList []string) func(string) bool {
|
||||
wg, err := wgctrl.New()
|
||||
if err != nil {
|
||||
log.Debugf("trying to create a wgctrl client failed with: %v", err)
|
||||
return true
|
||||
}
|
||||
defer func() {
|
||||
err := wg.Close()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
_ = wg.Close()
|
||||
}()
|
||||
|
||||
_, err = wg.Device(iFace)
|
||||
|
Loading…
Reference in New Issue
Block a user