Skip to content
New issue

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

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

Already on GitHub? # to your account

Remove two groups of resource leaks #878

Merged
merged 3 commits into from
Feb 3, 2025
Merged

Remove two groups of resource leaks #878

merged 3 commits into from
Feb 3, 2025

Conversation

woodruffw
Copy link
Member

@woodruffw woodruffw commented Feb 2, 2025

This eliminates two groups of resource leaks:

  1. Our Popen(...) wrapper wasn't closing pipe FDs correctly, since it incorrectly assumed that pipe PDs were closed by default. This was fixed by using it as a context manager instead.
  2. Our CLI used argparse.FileType for -r, --requirements, which always leaks a FD. It uses Path instead now.

Fixes #877 (CC @LeamHall to test, if possible!)

Signed-off-by: William Woodruff william@trailofbits.com

Signed-off-by: William Woodruff <william@trailofbits.com>
This API always leaks a file handle.

Signed-off-by: William Woodruff <william@trailofbits.com>
@woodruffw woodruffw added the chore Chores label Feb 2, 2025
@woodruffw woodruffw requested a review from di February 2, 2025 00:19
@woodruffw woodruffw self-assigned this Feb 2, 2025
@woodruffw woodruffw mentioned this pull request Feb 2, 2025
3 tasks
Signed-off-by: William Woodruff <william@trailofbits.com>
@di di merged commit 96d0dd9 into main Feb 3, 2025
10 checks passed
@di di deleted the ww/resource-warnings branch February 3, 2025 16:26
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
chore Chores
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: ResourceWarnings
2 participants