diff options
author | Ian Gudger <igudger@google.com> | 2019-06-28 20:06:33 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2019-06-28 20:07:52 -0700 |
commit | 45566fa4e4bc55e870ae1d7f80778be8432bdef5 (patch) | |
tree | 9b9064ef22a6f34ade4714cc90ad0573440c3e1c /pkg/sentry/socket/unix/unix.go | |
parent | 7dae043fecc109d7a0ae1d5d6274e48b1bf04d13 (diff) |
Add finalizer on AtomicRefCount to check for leaks.
PiperOrigin-RevId: 255711454
Diffstat (limited to 'pkg/sentry/socket/unix/unix.go')
-rw-r--r-- | pkg/sentry/socket/unix/unix.go | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/pkg/sentry/socket/unix/unix.go b/pkg/sentry/socket/unix/unix.go index 6190de0c5..bf7d2cfa2 100644 --- a/pkg/sentry/socket/unix/unix.go +++ b/pkg/sentry/socket/unix/unix.go @@ -69,10 +69,13 @@ func New(ctx context.Context, endpoint transport.Endpoint, stype linux.SockType) // NewWithDirent creates a new unix socket using an existing dirent. func NewWithDirent(ctx context.Context, d *fs.Dirent, ep transport.Endpoint, stype linux.SockType, flags fs.FileFlags) *fs.File { - return fs.NewFile(ctx, d, flags, &SocketOperations{ + s := SocketOperations{ ep: ep, stype: stype, - }) + } + s.EnableLeakCheck("unix.SocketOperations") + + return fs.NewFile(ctx, d, flags, &s) } // DecRef implements RefCounter.DecRef. |