Fix leaks and add test

This commit is contained in:
世界
2022-09-23 13:14:31 +08:00
parent ab7478a80c
commit 01865024b0
19 changed files with 167 additions and 59 deletions

View File

@@ -162,9 +162,8 @@ func (w *WireGuard) Start() error {
}
func (w *WireGuard) Close() error {
return common.Close(
w.tunDevice,
common.PtrOrNil(w.device),
common.PtrOrNil(w.bind),
)
if w.device != nil {
w.device.Close()
}
return common.Close(w.tunDevice)
}