Skip to content
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

[Bug] File Handler Leak #1308

Closed
stasos24 opened this issue Nov 28, 2023 · 3 comments
Closed

[Bug] File Handler Leak #1308

stasos24 opened this issue Nov 28, 2023 · 3 comments

Comments

@stasos24
Copy link
Contributor

In case of error at line:

err = enc.Encode([]types.Report{

Handler:
f, err := os.Create(destination)

won't be freed on

Solution:
Replace - return f.Close() with return 0
Add defer f.Close at line 20

@stasos24 stasos24 changed the title File Handle Leak [Bug] File Handler Leak Nov 28, 2023
@stasos24
Copy link
Contributor Author

In case of error at:

err = enc.Encode(allReports)

Handler:
f, err := os.Create(destination)

won't be freed on:
return messages, err

@onsi
Copy link
Owner

onsi commented Nov 28, 2023

hey there - thanks for catching for this. can you submit a PR?

@stasos24
Copy link
Contributor Author

hey there - thanks for catching for this. can you submit a PR?

Yes, of course
#1309

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants