summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/fs/file.go
diff options
context:
space:
mode:
authorIan Gudger <igudger@google.com>2019-06-28 20:06:33 -0700
committergVisor bot <gvisor-bot@google.com>2019-06-28 20:07:52 -0700
commit45566fa4e4bc55e870ae1d7f80778be8432bdef5 (patch)
tree9b9064ef22a6f34ade4714cc90ad0573440c3e1c /pkg/sentry/fs/file.go
parent7dae043fecc109d7a0ae1d5d6274e48b1bf04d13 (diff)
Add finalizer on AtomicRefCount to check for leaks.
PiperOrigin-RevId: 255711454
Diffstat (limited to 'pkg/sentry/fs/file.go')
-rw-r--r--pkg/sentry/fs/file.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/pkg/sentry/fs/file.go b/pkg/sentry/fs/file.go
index 8e1f5674d..bb8117f89 100644
--- a/pkg/sentry/fs/file.go
+++ b/pkg/sentry/fs/file.go
@@ -130,14 +130,15 @@ type File struct {
// to false respectively.
func NewFile(ctx context.Context, dirent *Dirent, flags FileFlags, fops FileOperations) *File {
dirent.IncRef()
- f := &File{
+ f := File{
UniqueID: uniqueid.GlobalFromContext(ctx),
Dirent: dirent,
FileOperations: fops,
flags: flags,
}
f.mu.Init()
- return f
+ f.EnableLeakCheck("fs.File")
+ return &f
}
// DecRef destroys the File when it is no longer referenced.