Subject: Re: memory leak in _libssh2_channel_open

Re: memory leak in _libssh2_channel_open

From: Peter Stuge <peter_at_stuge.se>
Date: Fri, 24 Feb 2012 17:15:01 +0100

Steven Dake wrote:
> I'll be happy to try out your patch later today and report results back
> sometime this weekend.

Thanks!

> > Please see if the attached patch fixes the leak while still allowing
> > your program to keep running for a long time. I'm not completely sure
> > if the payload would need to be freed explicitly in _session_free()
>
> I had thought along these same lines, but the problem with freeing in
> sesson_free is that I don't free my session unless the connection is
> determined faulty. I could free and create a new session occasionally
> to hack around that, but seems like there should be a better way ;)

No, freeing session->payload in libssh2_session_free() is not the
solution to your problem, but it may be needed to properly clean up.

> one packet leaked is ok (with me), thousands not ok (current codebase).

One packet leaked is not ok with me.

> I'm here to help with finding any bugs/leaks/etc with libssh2. I
> can even help fix them - I've studied the code base for about 12
> hours so have a reasonable idea of how it operates.

All good. Looking forward to results from testing the patch.

//Peter
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2012-02-24