On Wednesday, February 17, 2016 19:08:47 Velichko Yuriy wrote: > int res = LIBSSH2_ERROR_EAGAIN; > > while( res != 0 ) > > re = libssh2_channel_free(channel); > > > This code helps, but is it safe? Can be infinity loop here?
This looks wrong to me. You need to call the library function again in case it returns LIBSSH2_ERROR_EAGAIN, but break the loop in case it returns another error code. Kamil > Maybe other solution are exist? > > On 17 February 2016 at 18:56, Velichko Yuriy <velichko.yu...@gmail.com> > > wrote: > > Thanks, Kamil. > > Can you point me on example how to handle LIBSSH2_ERROR_EAGAIN to free > > resources properly? > > > > On 17 February 2016 at 17:47, Kamil Dudka <kdu...@redhat.com> wrote: > >> On Wednesday, February 17, 2016 16:04:06 Velichko Yuriy wrote: > >> > In the attached archive an example based on libssh2 docs: > >> > > >> > http://www.libssh2.org/examples/tcpip-forward.html > >> > > >> > In the attached code the port forwarding is implemented. In the > >> > infinity > >> > loop we preforms port forwarding of the PostgreSQL port on the remote > >> > computer. In the end of the loop all resources are freeing. > >> > > >> > But memory increases constantly. > >> > > >> > I think that I'm doing something wrong. Tell me please what exactly? ) > >> > >> Your code does not seem to handle LIBSSH2_ERROR_EAGAIN coming out > >> of libssh2_channel_free() and libssh2_session_free(). It should. > >> > >> Kamil > > > > -- > > С уважением, Величко Юрий. _______________________________________________ libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel