Skip to content

Commit 81756fc

Browse files
committed
fix: wireguard outbound memory leaks when close
1 parent 518e9bd commit 81756fc

File tree

3 files changed

+3
-5
lines changed

3 files changed

+3
-5
lines changed

adapter/outbound/wireguard.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import (
2626

2727
wireguard "github.com/metacubex/sing-wireguard"
2828

29-
"github.com/sagernet/sing/common"
3029
"github.com/sagernet/sing/common/debug"
3130
E "github.com/sagernet/sing/common/exceptions"
3231
M "github.com/sagernet/sing/common/metadata"
@@ -456,7 +455,6 @@ func closeWireGuard(w *WireGuard) {
456455
if w.device != nil {
457456
w.device.Close()
458457
}
459-
_ = common.Close(w.tunDevice)
460458
if w.closeCh != nil {
461459
close(w.closeCh)
462460
}

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ require (
2727
github.com/metacubex/sing-shadowsocks2 v0.2.2
2828
github.com/metacubex/sing-tun v0.2.7-0.20240729131039-ed03f557dee1
2929
github.com/metacubex/sing-vmess v0.1.9-0.20240719134745-1df6fb20bbf9
30-
github.com/metacubex/sing-wireguard v0.0.0-20240618022557-a6efaa37127a
30+
github.com/metacubex/sing-wireguard v0.0.0-20240826061955-1e4e67afe5cd
3131
github.com/metacubex/tfo-go v0.0.0-20240821025650-e9be0afd5e7d
3232
github.com/metacubex/utls v1.6.6
3333
github.com/miekg/dns v1.1.62

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ github.com/metacubex/sing-tun v0.2.7-0.20240729131039-ed03f557dee1 h1:ypfofGDZbP
120120
github.com/metacubex/sing-tun v0.2.7-0.20240729131039-ed03f557dee1/go.mod h1:olbEx9yVcaw5tHTNlRamRoxmMKcvDvcVS1YLnQGzvWE=
121121
github.com/metacubex/sing-vmess v0.1.9-0.20240719134745-1df6fb20bbf9 h1:OAXiCosqY8xKDp3pqTW3qbrCprZ1l6WkrXSFSCwyY4I=
122122
github.com/metacubex/sing-vmess v0.1.9-0.20240719134745-1df6fb20bbf9/go.mod h1:olVkD4FChQ5gKMHG4ZzuD7+fMkJY1G8vwOKpRehjrmY=
123-
github.com/metacubex/sing-wireguard v0.0.0-20240618022557-a6efaa37127a h1:NpSGclHJUYndUwBmyIpFBSoBVg8PoVX7QQKhYg0DjM0=
124-
github.com/metacubex/sing-wireguard v0.0.0-20240618022557-a6efaa37127a/go.mod h1:uY+BYb0UEknLrqvbGcwi9i++KgrKxsurysgI6G1Pveo=
123+
github.com/metacubex/sing-wireguard v0.0.0-20240826061955-1e4e67afe5cd h1:r7alry8u4qlUFLNMwGvG1A8ZcfPM6AMSmrm6E2yKdB4=
124+
github.com/metacubex/sing-wireguard v0.0.0-20240826061955-1e4e67afe5cd/go.mod h1:uY+BYb0UEknLrqvbGcwi9i++KgrKxsurysgI6G1Pveo=
125125
github.com/metacubex/tfo-go v0.0.0-20240821025650-e9be0afd5e7d h1:j9LtzkYstLFoNvXW824QQeN7Y26uPL5249kzWKbzO9U=
126126
github.com/metacubex/tfo-go v0.0.0-20240821025650-e9be0afd5e7d/go.mod h1:c7bVFM9f5+VzeZ/6Kg77T/jrg1Xp8QpqlSHvG/aXVts=
127127
github.com/metacubex/utls v1.6.6 h1:3D12YKHTf2Z41UPhQU2dWerNWJ5TVQD9gKoQ+H+iLC8=

0 commit comments

Comments
 (0)