session.c: check return value of session_nonblock in debug mode

Reported by Coverity CID 89805.
This commit is contained in:
Marc Hoersken 2014-12-26 13:40:42 +01:00
parent 22204c4e2e
commit d1eccb487a

View File

@ -1040,9 +1040,14 @@ session_free(LIBSSH2_SESSION *session)
_libssh2_debug(session, LIBSSH2_TRACE_TRANS,
"Extra packets left %d", packets_left);
if(session->socket_prev_blockstate)
if(session->socket_prev_blockstate) {
/* if the socket was previously blocking, put it back so */
session_nonblock(session->socket_fd, 0);
rc = session_nonblock(session->socket_fd, 0);
if (rc) {
_libssh2_debug(session, LIBSSH2_TRACE_TRANS,
"unable to reset socket's blocking state");
}
}
if (session->server_hostkey) {
LIBSSH2_FREE(session, session->server_hostkey);