summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/tcpip')
-rw-r--r--pkg/tcpip/link/tun/tun_endpoint_refs.go9
1 files changed, 2 insertions, 7 deletions
diff --git a/pkg/tcpip/link/tun/tun_endpoint_refs.go b/pkg/tcpip/link/tun/tun_endpoint_refs.go
index dc164902b..276cbdb20 100644
--- a/pkg/tcpip/link/tun/tun_endpoint_refs.go
+++ b/pkg/tcpip/link/tun/tun_endpoint_refs.go
@@ -54,11 +54,6 @@ func (r *tunEndpointRefs) LogRefs() bool {
return tunEndpointenableLogging
}
-// EnableLeakCheck enables reference leak checking on r.
-func (r *tunEndpointRefs) EnableLeakCheck() {
- refsvfs2.Register(r)
-}
-
// ReadRefs returns the current number of references. The returned count is
// inherently racy and is unsafe to use without external synchronization.
func (r *tunEndpointRefs) ReadRefs() int64 {
@@ -115,7 +110,7 @@ func (r *tunEndpointRefs) TryIncRef() bool {
func (r *tunEndpointRefs) DecRef(destroy func()) {
v := atomic.AddInt64(&r.refCount, -1)
if tunEndpointenableLogging {
- refsvfs2.LogDecRef(r, v+1)
+ refsvfs2.LogDecRef(r, v)
}
switch {
case v < 0:
@@ -132,6 +127,6 @@ func (r *tunEndpointRefs) DecRef(destroy func()) {
func (r *tunEndpointRefs) afterLoad() {
if r.ReadRefs() > 0 {
- r.EnableLeakCheck()
+ refsvfs2.Register(r)
}
}