Subject: [libssh2] #246: libssh2_session_free does not release channels

[libssh2] #246: libssh2_session_free does not release channels

From: libssh2 Trac <trac_at_libssh2.stuge.se>
Date: Mon, 23 Jul 2012 15:16:14 -0000

#246: libssh2_session_free does not release channels
----------------------+--------------------
 Reporter: maxmtl | Owner:
     Type: defect | Status: new
 Priority: normal | Milestone: 1.4.3
Component: protocol | Version: 1.4.2
 Keywords: | Blocked By:
   Blocks: |
----------------------+--------------------
 If libssh2_session_free is called without the channel being freed
 previously by libssh2_channel_free a memory leak could occur.

 A mismatch of states variables in session_free() prevent the call to
 libssh2_channel_free function. session->state member is used instead of
 session->free_state.

 It causes a leak of around 600 bytes on every connection on my systems
 (Linux, x64 and PPC).

 The following patch correct the problem. Note that I am not sure of the
 state usage at line 861:

 if (session->state & LIBSSH2_STATE_NEWKEYS)

 I think it must stay as session->state.

 (Debugging done under contract for Accedian Networks)

-- 
Ticket URL: <http://trac.libssh2.org/ticket/246>
libssh2 <http://trac.libssh2.org/>
C library for writing portable SSH2 clients
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2012-07-23