diff options
Diffstat (limited to 'pkg/sentry/kernel/fs_context_refs.go')
-rw-r--r-- | pkg/sentry/kernel/fs_context_refs.go | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/pkg/sentry/kernel/fs_context_refs.go b/pkg/sentry/kernel/fs_context_refs.go index 6510157c7..d97c82fc9 100644 --- a/pkg/sentry/kernel/fs_context_refs.go +++ b/pkg/sentry/kernel/fs_context_refs.go @@ -54,11 +54,6 @@ func (r *FSContextRefs) LogRefs() bool { return FSContextenableLogging } -// EnableLeakCheck enables reference leak checking on r. -func (r *FSContextRefs) 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 *FSContextRefs) ReadRefs() int64 { @@ -115,7 +110,7 @@ func (r *FSContextRefs) TryIncRef() bool { func (r *FSContextRefs) DecRef(destroy func()) { v := atomic.AddInt64(&r.refCount, -1) if FSContextenableLogging { - refsvfs2.LogDecRef(r, v+1) + refsvfs2.LogDecRef(r, v) } switch { case v < 0: @@ -132,6 +127,6 @@ func (r *FSContextRefs) DecRef(destroy func()) { func (r *FSContextRefs) afterLoad() { if r.ReadRefs() > 0 { - r.EnableLeakCheck() + refsvfs2.Register(r) } } |