Merge pull request #102555 from wzshiming/fix/close-modules-file

Close the used modules file
This commit is contained in:
Kubernetes Prow Robot 2021-06-09 14:55:26 -07:00 committed by GitHub
commit e692207857
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -633,6 +633,7 @@ func (handle *LinuxKernelHandler) GetModules() ([]string, error) {
if err != nil { if err != nil {
return nil, fmt.Errorf("Failed to read file /proc/modules with error %v", err) return nil, fmt.Errorf("Failed to read file /proc/modules with error %v", err)
} }
defer modulesFile.Close()
mods, err := getFirstColumn(modulesFile) mods, err := getFirstColumn(modulesFile)
if err != nil { if err != nil {