Add more NULL checking/error handling

This commit is contained in:
Brendan Shanks 2018-11-04 22:16:39 -08:00
parent e40173c290
commit 19f2abd166
1 changed files with 6 additions and 0 deletions

View File

@ -1665,12 +1665,18 @@ void *ssh2_thread(WindRec*w)
{
LIBSSH2_SESSION *session = libssh2_session_init_ex(NULL, NULL, NULL, w);
if (!session) {
syslog(0, "libssh2_session_init_ex() failed\n");
goto closesocket;
}
if (w->trace)
libssh2_trace(session, INT_MAX);
libssh2_trace_sethandler(session, NULL, libssh2_handler);
if (libssh2_session_startup(session, sock)) {
syslog(0, "Failure establishing SSH session\n");
goto closesession;
}
if (!ssh2_hostkey_approved(session, hostname, w->portNum))