free "outbuf" when killing a session
Fix memoary leak: if there was an "output" still allocated when a session was torn down it needs to be freed in session_free() Patch by Yoichi Iwaki in bug #2929647
This commit is contained in:
@@ -698,6 +698,7 @@ session_free(LIBSSH2_SESSION *session)
|
||||
LIBSSH2_PACKET *pkg;
|
||||
LIBSSH2_CHANNEL *ch;
|
||||
LIBSSH2_LISTENER *l;
|
||||
struct transportpacket *p = &session->packet;
|
||||
|
||||
if (session->free_state == libssh2_NB_state_idle) {
|
||||
_libssh2_debug(session, LIBSSH2_TRACE_TRANS, "Freeing session resource",
|
||||
@@ -919,6 +920,11 @@ session_free(LIBSSH2_SESSION *session)
|
||||
LIBSSH2_FREE(session, pkg);
|
||||
}
|
||||
|
||||
/* Cleanup remaining outgoing packet buffer */
|
||||
if (p->outbuf) {
|
||||
LIBSSH2_FREE(session, p->outbuf);
|
||||
}
|
||||
|
||||
if(session->socket_prev_blockstate)
|
||||
/* if the socket was previously blocking, put it back so */
|
||||
session_nonblock(session->socket_fd, 0);
|
||||
|
Reference in New Issue
Block a user