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

ssh: free the session on init failures #3179

Closed
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
2 participants
@danielgustafsson
Member

danielgustafsson commented Oct 26, 2018

Ensure to clear the session object in case the libssh2 initialization fails.

It could be argued that the libssh2 error function should be called to get a proper error message in this case. But since the only error path in libssh2_knownhost_init() is memory a allocation failure it's safest
to avoid since the libssh2 error handling allocates memory.

ssh: free the session on init failures
Ensure to clear the session object in case the libssh2 initialization
fails.

It could be argued that the libssh2 error function should be called to
get a proper error message in this case. But since the only error path
in libssh2_knownhost_init() is memory a allocation failure it's safest
to avoid since the libssh2 error handling allocates memory.
@bagder

bagder approved these changes Oct 26, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment