diff options
author | gVisor bot <gvisor-bot@google.com> | 2019-12-17 00:26:38 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2019-12-17 00:26:38 +0000 |
commit | 24f0e02b308d09de37c2932b98a241df9a5e2f6a (patch) | |
tree | 8ed3371c6ac39a29bd7c5e7cd241a480e61033e7 /pkg | |
parent | d646a6798aefea611b06543644112df903ed2428 (diff) | |
parent | 2e2545b45861218c963836fabf6f13e6d2f10c9e (diff) |
Merge release-20191210.0-34-g2e2545b (automated)
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/sentry/fs/gofer/path.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/pkg/sentry/fs/gofer/path.go b/pkg/sentry/fs/gofer/path.go index 8c17603f8..c09f3b71c 100644 --- a/pkg/sentry/fs/gofer/path.go +++ b/pkg/sentry/fs/gofer/path.go @@ -234,6 +234,8 @@ func (i *inodeOperations) Bind(ctx context.Context, dir *fs.Inode, name string, if err != nil { return nil, err } + // We're not going to use newFile after return. + defer newFile.close(ctx) // Stabilize the endpoint map while creation is in progress. unlock := i.session().endpoints.lock() @@ -254,7 +256,6 @@ func (i *inodeOperations) Bind(ctx context.Context, dir *fs.Inode, name string, // Get the attributes of the file to create inode key. qid, mask, attr, err := getattr(ctx, newFile) if err != nil { - newFile.close(ctx) return nil, err } @@ -270,7 +271,6 @@ func (i *inodeOperations) Bind(ctx context.Context, dir *fs.Inode, name string, // cloned and re-opened multiple times after creation. _, unopened, err := i.fileState.file.walk(ctx, []string{name}) if err != nil { - newFile.close(ctx) return nil, err } |