mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
[vfs2] Don't take reference in Task.MountNamespaceVFS2 and MountNamespace.Root.
This fixes reference leaks related to accidentally forgetting to DecRef() after calling one or the other. PiperOrigin-RevId: 336918922
This commit is contained in:
@@ -95,10 +95,13 @@ func NewAccessor(ctx context.Context, vfsObj *vfs.VirtualFilesystem, creds *auth
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// Pass a reference on root to the Accessor.
|
||||
root := mntns.Root()
|
||||
root.IncRef()
|
||||
return &Accessor{
|
||||
vfsObj: vfsObj,
|
||||
mntns: mntns,
|
||||
root: mntns.Root(),
|
||||
root: root,
|
||||
creds: creds,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -53,6 +53,7 @@ func setupDevtmpfs(t *testing.T) (context.Context, *auth.Credentials, *vfs.Virtu
|
||||
t.Fatalf("failed to create tmpfs root mount: %v", err)
|
||||
}
|
||||
root := mntns.Root()
|
||||
root.IncRef()
|
||||
devpop := vfs.PathOperation{
|
||||
Root: root,
|
||||
Start: root,
|
||||
|
||||
Reference in New Issue
Block a user