Skip to content

Conversation

@caarlos0
Copy link
Member

@caarlos0 caarlos0 commented Jan 9, 2026

if it fell into one of the ifs there, it would not close the response body.

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
@caarlos0 caarlos0 self-assigned this Jan 9, 2026
Copilot AI review requested due to automatic review settings January 9, 2026 19:17
@caarlos0 caarlos0 requested a review from a team as a code owner January 9, 2026 19:17
@caarlos0 caarlos0 requested review from meowgorithm and raphamorim and removed request for a team January 9, 2026 19:17
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a resource leak in the TestConnection function where the HTTP response body would not be closed if the function returned early due to status code validation failures.

Key changes:

  • Moved response body closing to use defer immediately after the HTTP request succeeds
  • Renamed variable from b to resp for clarity
  • Fixed comment capitalization

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@kujtimiihoxha kujtimiihoxha merged commit b884767 into main Jan 12, 2026
22 checks passed
@kujtimiihoxha kujtimiihoxha deleted the body-leak branch January 12, 2026 13:22
BrunoKrugel pushed a commit to BrunoKrugel/crush that referenced this pull request Jan 12, 2026
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
puffitos pushed a commit to puffitos/crush that referenced this pull request Jan 13, 2026
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
puffitos pushed a commit to puffitos/crush that referenced this pull request Jan 13, 2026
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
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.

3 participants