Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
SSH: Fix incorrect timeout failures on disconnects. #1479
libcurl is leaking memory when using sftp and a timeout. This was first reported on the mailing list.
The memory leak reported on the mailing list is a symptom of a larger problem - SSH sessions are not freed when a timeout is used. I suspect this problem is also present on other platforms, but may not manifest itself as a memory leak on all platforms.
I used the Visual Studio memory analysis tools to find that libssh2 is leaking some WinCNG structs for each connection. This is because libcurl is never calling the
In a disconnect situation, the
Two style warnings, as below, but I would like to see this problem fixed slightly differently. I think we should make
I suspected this change wouldn't get merged unscathed ;)
I did consider this, but not know too much about the internals of libcurl, I wanted to make as minimal a change as possible. Ditto for changing the closure handle. Good to know that these are legitimate options. I will update this pull request in the next day or two.