Skip to content

cleanup: fix file descriptor leak in cleanup_lockfiles#21611

Merged
MikeMcQuaid merged 1 commit intoHomebrew:mainfrom
rangaNP:fix/cleanup-lockfiles-fd-leak
Feb 23, 2026
Merged

cleanup: fix file descriptor leak in cleanup_lockfiles#21611
MikeMcQuaid merged 1 commit intoHomebrew:mainfrom
rangaNP:fix/cleanup-lockfiles-fd-leak

Conversation

@rangaNP
Copy link
Contributor

@rangaNP rangaNP commented Feb 22, 2026

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew lgtm (style, typechecking and tests) with your changes locally?

  • AI was used to generate or assist with generating this PR. Please specify below how you used AI to help you, and what steps you have taken to manually verify the changes.

cleanup_lockfiles leaks file descriptors by calling file.open without saving or closing the handle. Fixed by storing the handle and closing it on all code paths.

Copy link
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

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

Thanks, looks good so far! How about using file.open in the block form to avoid needing the manual .close?

@rangaNP rangaNP force-pushed the fix/cleanup-lockfiles-fd-leak branch from 8940aa4 to 77cfbef Compare February 23, 2026 10:40
Copy link
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

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

Great work, thanks!

@MikeMcQuaid MikeMcQuaid added this pull request to the merge queue Feb 23, 2026
Merged via the queue into Homebrew:main with commit d372d2a Feb 23, 2026
36 checks passed
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.

2 participants