mirror of
https://github.com/SagerNet/sing-box.git
synced 2026-08-04 06:34:50 +00:00
Fix netns fd leak in ListenNetworkNamespace
This commit is contained in:
parent
1d388547ee
commit
2ba896c5ac
1 changed files with 1 additions and 0 deletions
|
|
@ -151,6 +151,7 @@ func ListenNetworkNamespace[T any](nameOrPath string, block func() (T, error)) (
|
|||
if err != nil {
|
||||
return common.DefaultValue[T](), E.Cause(err, "get current netns")
|
||||
}
|
||||
defer currentNs.Close()
|
||||
defer netns.Set(currentNs)
|
||||
var targetNs netns.NsHandle
|
||||
if strings.HasPrefix(nameOrPath, "/") {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue