mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Merge pull request #1392 from zhuangel:bindleak
PiperOrigin-RevId: 285874181
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user