diff options
Diffstat (limited to 'pkg/sentry/socket')
-rw-r--r-- | pkg/sentry/socket/unix/socket_refs.go | 9 | ||||
-rw-r--r-- | pkg/sentry/socket/unix/socket_vfs2_refs.go | 9 | ||||
-rw-r--r-- | pkg/sentry/socket/unix/transport/queue_refs.go | 9 |
3 files changed, 6 insertions, 21 deletions
diff --git a/pkg/sentry/socket/unix/socket_refs.go b/pkg/sentry/socket/unix/socket_refs.go index e69a17ca8..2a7fcb253 100644 --- a/pkg/sentry/socket/unix/socket_refs.go +++ b/pkg/sentry/socket/unix/socket_refs.go @@ -54,11 +54,6 @@ func (r *socketOperationsRefs) LogRefs() bool { return socketOperationsenableLogging } -// EnableLeakCheck enables reference leak checking on r. -func (r *socketOperationsRefs) 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 *socketOperationsRefs) ReadRefs() int64 { @@ -115,7 +110,7 @@ func (r *socketOperationsRefs) TryIncRef() bool { func (r *socketOperationsRefs) DecRef(destroy func()) { v := atomic.AddInt64(&r.refCount, -1) if socketOperationsenableLogging { - refsvfs2.LogDecRef(r, v+1) + refsvfs2.LogDecRef(r, v) } switch { case v < 0: @@ -132,6 +127,6 @@ func (r *socketOperationsRefs) DecRef(destroy func()) { func (r *socketOperationsRefs) afterLoad() { if r.ReadRefs() > 0 { - r.EnableLeakCheck() + refsvfs2.Register(r) } } diff --git a/pkg/sentry/socket/unix/socket_vfs2_refs.go b/pkg/sentry/socket/unix/socket_vfs2_refs.go index d9bdba0b3..f10033260 100644 --- a/pkg/sentry/socket/unix/socket_vfs2_refs.go +++ b/pkg/sentry/socket/unix/socket_vfs2_refs.go @@ -54,11 +54,6 @@ func (r *socketVFS2Refs) LogRefs() bool { return socketVFS2enableLogging } -// EnableLeakCheck enables reference leak checking on r. -func (r *socketVFS2Refs) 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 *socketVFS2Refs) ReadRefs() int64 { @@ -115,7 +110,7 @@ func (r *socketVFS2Refs) TryIncRef() bool { func (r *socketVFS2Refs) DecRef(destroy func()) { v := atomic.AddInt64(&r.refCount, -1) if socketVFS2enableLogging { - refsvfs2.LogDecRef(r, v+1) + refsvfs2.LogDecRef(r, v) } switch { case v < 0: @@ -132,6 +127,6 @@ func (r *socketVFS2Refs) DecRef(destroy func()) { func (r *socketVFS2Refs) afterLoad() { if r.ReadRefs() > 0 { - r.EnableLeakCheck() + refsvfs2.Register(r) } } diff --git a/pkg/sentry/socket/unix/transport/queue_refs.go b/pkg/sentry/socket/unix/transport/queue_refs.go index 679cb40e4..42c5b7ce0 100644 --- a/pkg/sentry/socket/unix/transport/queue_refs.go +++ b/pkg/sentry/socket/unix/transport/queue_refs.go @@ -54,11 +54,6 @@ func (r *queueRefs) LogRefs() bool { return queueenableLogging } -// EnableLeakCheck enables reference leak checking on r. -func (r *queueRefs) 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 *queueRefs) ReadRefs() int64 { @@ -115,7 +110,7 @@ func (r *queueRefs) TryIncRef() bool { func (r *queueRefs) DecRef(destroy func()) { v := atomic.AddInt64(&r.refCount, -1) if queueenableLogging { - refsvfs2.LogDecRef(r, v+1) + refsvfs2.LogDecRef(r, v) } switch { case v < 0: @@ -132,6 +127,6 @@ func (r *queueRefs) DecRef(destroy func()) { func (r *queueRefs) afterLoad() { if r.ReadRefs() > 0 { - r.EnableLeakCheck() + refsvfs2.Register(r) } } |