Skip to content

openssh_fixture: fix to close socket on connect failure - #1855

Closed
vszakats wants to merge 2 commits into
libssh2:masterfrom
vszakats:test-close-failed-socket
Closed

vszakats wants to merge 2 commits into
libssh2:masterfrom
vszakats:test-close-failed-socket

Conversation

@vszakats

Copy link
Copy Markdown
Member

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Fixes a resource leak in the OpenSSH test fixture by ensuring the TCP socket is closed when all connection attempts to the target container fail.

Changes:

  • Close the opened socket before reporting a connection failure and returning from open_socket_to_container.
Comments suppressed due to low confidence (1)

tests/openssh_fixture.c:419

  • close_socket_to_container is defined later in the file and there is no forward declaration before this call. In C99+ this results in a compile error (implicit function declarations are not allowed). Add a static void close_socket_to_container(libssh2_socket_t sock); prototype above open_socket_to_container, or move the close_socket_to_container definition above this function.
                   sizeof(struct sockaddr_in))) {

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

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.


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

vszakats added a commit to vszakats/libssh2 that referenced this pull request Apr 12, 2026
@vszakats vszakats closed this in 5ddc599 Apr 13, 2026
@vszakats
vszakats deleted the test-close-failed-socket branch April 13, 2026 09:06
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