summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry
diff options
context:
space:
mode:
authorJamie Liu <jamieliu@google.com>2020-04-27 07:37:45 -0700
committergVisor bot <gvisor-bot@google.com>2020-04-27 07:39:10 -0700
commit292f3f99b73fb901ffdd3ad8ac682718e1e8960a (patch)
tree1bbb19e469c1a9e4028298903415d6502dd7a5ae /pkg/sentry
parent3c67754663f424f2ebbc0ff2a4c80e30618d5355 (diff)
Don't leak vfs.MountNamespace reference if kernel.TaskSet.NewTask fails.
PiperOrigin-RevId: 308617610
Diffstat (limited to 'pkg/sentry')
-rw-r--r--pkg/sentry/kernel/task_start.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/pkg/sentry/kernel/task_start.go b/pkg/sentry/kernel/task_start.go
index a5035bb7f..8485fb4b6 100644
--- a/pkg/sentry/kernel/task_start.go
+++ b/pkg/sentry/kernel/task_start.go
@@ -104,6 +104,9 @@ func (ts *TaskSet) NewTask(cfg *TaskConfig) (*Task, error) {
cfg.TaskContext.release()
cfg.FSContext.DecRef()
cfg.FDTable.DecRef()
+ if cfg.MountNamespaceVFS2 != nil {
+ cfg.MountNamespaceVFS2.DecRef()
+ }
return nil, err
}
return t, nil