mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Cleanup socket in lisafs gofer's BindAt handler on error paths.
Otherwise, we leak will leak the un-closed FD. PiperOrigin-RevId: 473294586
This commit is contained in:
@@ -690,12 +690,14 @@ func (fd *controlFDLisa) BindAt(name string, sockType uint32) (*lisafs.ControlFD
|
||||
return nil, linux.Statx{}, nil, -1, err
|
||||
}
|
||||
if err := unix.Bind(sockFD, &unix.SockaddrUnix{Name: socketPath}); err != nil {
|
||||
_ = unix.Close(sockFD)
|
||||
return nil, linux.Statx{}, nil, -1, err
|
||||
}
|
||||
|
||||
// Stat the socket.
|
||||
sockStat, err := fstatTo(sockFD)
|
||||
if err != nil {
|
||||
_ = unix.Close(sockFD)
|
||||
_ = unix.Unlink(socketPath)
|
||||
return nil, linux.Statx{}, nil, -1, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user