8000 Fix potentially unclosed file in runtimeVM#CreateContainer by tedyu · Pull Request #3953 · cri-o/cri-o · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix potentially unclosed file in runtimeVM#CreateContainer #3953

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 15, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions internal/oci/runtime_vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,12 @@ func (r *runtimeVM) CreateContainer(c *Container, cgroupParent string) (err erro

select {
case err = <-createdCh:
f.Close()
Copy link
Member

how is the file closed in the timeout case?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think similar handling should be done in timeout case.
Should I include that change in this PR ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah can you include it in this PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have updated the PR

if err != nil {
return errors.Errorf("CreateContainer failed: %v", err)
}
case <-time.After(ContainerCreateTimeout):
f.Close()
if err := r.remove(r.ctx, c.ID(), ""); err != nil {
return err
}
Expand Down
0