mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-15 16:33:40 +00:00
fix resource leak in os.(*File).Close
Signed-off-by: Achille Roussel <achille.roussel@gmail.com>
This commit is contained in:
committed by
Ron Evans
parent
17bc0d6663
commit
85da9a0aac
@@ -42,6 +42,14 @@ type file struct {
|
||||
dirinfo *dirInfo // nil unless directory being read
|
||||
}
|
||||
|
||||
func (f *file) close() (err error) {
|
||||
if f.dirinfo != nil {
|
||||
f.dirinfo.close()
|
||||
f.dirinfo = nil
|
||||
}
|
||||
return f.handle.Close()
|
||||
}
|
||||
|
||||
func NewFile(fd uintptr, name string) *File {
|
||||
return &File{&file{unixFileHandle(fd), name, nil}}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user