summaryrefslogtreecommitdiffhomepage
path: root/pkg
diff options
context:
space:
mode:
authorChristopher Koch <chrisko@google.com>2018-05-16 14:53:57 -0700
committerShentubot <shentubot@google.com>2018-05-16 14:54:48 -0700
commit8e1deb2ab8fb67da9a1f6521e31c5635ac587e71 (patch)
treec8f20132aff8a9f64f2849cdab73adc2f9019176 /pkg
parent3131a6b131127e70b5e3941e3c4d292d99312fa5 (diff)
Fix another socket Dirent refcount.
PiperOrigin-RevId: 196893452 Change-Id: I5ea0f851fcabc5eac5859e61f15213323d996337
Diffstat (limited to 'pkg')
-rw-r--r--pkg/sentry/socket/rpcinet/socket.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/pkg/sentry/socket/rpcinet/socket.go b/pkg/sentry/socket/rpcinet/socket.go
index 2911d3fd6..11925f8d8 100644
--- a/pkg/sentry/socket/rpcinet/socket.go
+++ b/pkg/sentry/socket/rpcinet/socket.go
@@ -71,6 +71,7 @@ func newSocketFile(ctx context.Context, stack *Stack, family int, skType int, pr
stack.notifier.AddFD(fd, &wq)
dirent := socket.NewDirent(ctx, socketDevice)
+ defer dirent.DecRef()
return fs.NewFile(ctx, dirent, fs.FileFlags{Read: true, Write: true}, &socketOperations{
wq: &wq,
fd: fd,
@@ -274,6 +275,7 @@ func (s *socketOperations) Accept(t *kernel.Task, peerRequested bool, flags int,
s.notifier.AddFD(payload.Fd, &wq)
dirent := socket.NewDirent(t, socketDevice)
+ defer dirent.DecRef()
file := fs.NewFile(t, dirent, fs.FileFlags{Read: true, Write: true, NonBlocking: flags&linux.SOCK_NONBLOCK != 0}, &socketOperations{
wq: &wq,
fd: payload.Fd,