Commit 287f703d authored by FengyunPan's avatar FengyunPan

Close file after os.Open()

parent 5dd56c9b
......@@ -95,6 +95,7 @@ func setupProviderConfig() error {
framework.Logf("Couldn't open cloud provider configuration %s: %#v",
cloudConfig.ConfigFile, err)
}
defer config.Close()
cloudConfig.Provider, err = azure.NewCloud(config)
}
......
......@@ -2013,6 +2013,7 @@ func newStreamingUpload(filePath string) (*io.PipeReader, *multipart.Writer, err
if err != nil {
return nil, nil, err
}
defer file.Close()
r, w := io.Pipe()
......
......@@ -372,6 +372,7 @@ func injectLog(file string, timestamp time.Time, log string, num int) error {
if err != nil {
return err
}
defer f.Close()
for i := 0; i < num; i++ {
_, err := f.WriteString(fmt.Sprintf("%s kernel: [0.000000] %s\n", timestamp.Format(time.Stamp), log))
if err != nil {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment