cURL / Mailing Lists / curl-library / Single Mail


Re: FW: scp upload failure memory leak

From: Jeff Weber <>
Date: Wed, 21 May 2008 21:08:37 -0500

On Wed, May 21, 2008 at 08:16:21PM +0200, Daniel Stenberg wrote:
> On Wed, 21 May 2008, Jeff Weber wrote:
>> I tried adding a call to
>> state(conn, SSH_SCP_CHANNEL_FREE);
>> inside ssh.c:scp_disconnect() to no avail. I'm not familiar with the
>> details
>> of the SSH state machine. Any help would be appreciated.
>> Alternatively, I tried uploading to sftp:// . This protocol also leaks
>> upon a transfer timeout.
> I'll look into this as soon as I get some time for it. Any chance you can
> write up a test case for the test suite that repeats this problem? It'd
> help us a lot...

I've attached tests/data/test62[78] with scp and sftp upload timeouts
respectively, showing memory leaks. The tests requires an sshd that will write
to /dev/null. The test cases just upload /dev/zero to scp://localhost/dev/null
with a --max-time timeout.

I've studied the scp case a bit more, and can offer this: the timeout occurs
while a channel is open. The bug is that the SSH_CHANNEL_FREE state is not
entered before the SSH_SESSION_DISCONNECT state. Thus, the channel is leaked.

I have not had a chance to study the sftp timeout.


“This e-mail message and any attachments are confidential and may be privileged.
If you are not the intended recipient please notify American Superconductor Corporation
immediately by replying to this message or by sending a message to
and destroy all copies of this message and any attachments.
Thank you.”

Received on 2008-05-22