summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/syscalls/linux/vfs2
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/sentry/syscalls/linux/vfs2')
-rwxr-xr-xpkg/sentry/syscalls/linux/vfs2/socket.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/pkg/sentry/syscalls/linux/vfs2/socket.go b/pkg/sentry/syscalls/linux/vfs2/socket.go
index 79a4a7ada..b1ede32f0 100755
--- a/pkg/sentry/syscalls/linux/vfs2/socket.go
+++ b/pkg/sentry/syscalls/linux/vfs2/socket.go
@@ -250,8 +250,9 @@ func SocketPair(t *kernel.Task, args arch.SyscallArguments) (uintptr, *kernel.Sy
if _, err := t.CopyOut(addr, fds); err != nil {
for _, fd := range fds {
- _, file := t.FDTable().Remove(fd)
- file.DecRef()
+ if _, file := t.FDTable().Remove(fd); file != nil {
+ file.DecRef()
+ }
}
return 0, nil, err
}