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

Close file handles/descriptors properly #367

Merged
merged 2 commits into from
Jul 8, 2021
Merged

Conversation

AlexeyBond
Copy link
Contributor

Files were handled in an unsafe way that could cause memory/descriptor leaks in case of some errors.

@netroy
Copy link
Member

netroy commented Jul 6, 2021

@AlexeyBond while it does make sense to close the descriptor in a finally, can you please share a test case where you saw these leaks happen?

@AlexeyBond
Copy link
Contributor Author

@netroy I didn't actually see those leaks happen, but once I saw the code I saw that they may happen. One case I could find - Buffer.alloc may throw an exception when it cannot allocate the buffer because of lack of free memory.

@sonarcloud
Copy link

sonarcloud bot commented Jul 6, 2021

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@netroy netroy merged commit 71e1410 into image-size:main Jul 8, 2021
@netroy
Copy link
Member

netroy commented Jul 8, 2021

@AlexeyBond Thanks for the additional test 🙇

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

Successfully merging this pull request may close these issues.

None yet

2 participants