Close file after os.Open()
This commit is contained in:
parent
5dd56c9b1e
commit
287f703d3a
@ -95,6 +95,7 @@ func setupProviderConfig() error {
|
|||||||
framework.Logf("Couldn't open cloud provider configuration %s: %#v",
|
framework.Logf("Couldn't open cloud provider configuration %s: %#v",
|
||||||
cloudConfig.ConfigFile, err)
|
cloudConfig.ConfigFile, err)
|
||||||
}
|
}
|
||||||
|
defer config.Close()
|
||||||
cloudConfig.Provider, err = azure.NewCloud(config)
|
cloudConfig.Provider, err = azure.NewCloud(config)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2013,6 +2013,7 @@ func newStreamingUpload(filePath string) (*io.PipeReader, *multipart.Writer, err
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
defer file.Close()
|
||||||
|
|
||||||
r, w := io.Pipe()
|
r, w := io.Pipe()
|
||||||
|
|
||||||
|
@ -372,6 +372,7 @@ func injectLog(file string, timestamp time.Time, log string, num int) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
defer f.Close()
|
||||||
for i := 0; i < num; i++ {
|
for i := 0; i < num; i++ {
|
||||||
_, err := f.WriteString(fmt.Sprintf("%s kernel: [0.000000] %s\n", timestamp.Format(time.Stamp), log))
|
_, err := f.WriteString(fmt.Sprintf("%s kernel: [0.000000] %s\n", timestamp.Format(time.Stamp), log))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user