cURL / Mailing Lists / curl-library / Single Mail


Re: FW: scp upload failure memory leak

From: Jeff Weber <>
Date: Thu, 12 Jun 2008 12:27:06 -0500

On Wed, Jun 11, 2008 at 11:26:31PM +0200, Daniel Stenberg wrote:
> On Wed, 11 Jun 2008, Jeff Weber wrote:
>> curl 7.18.2 sftp upload with password authentication leaks. valgrind
>> output attached.
>> curl 7.18.2 sftp upload with publickey authentication leaks. valgrind
>> output attached.
>> To test these, I ran the curl command line tool from valgrind, and varied
>> the authentication methods. The valgrind output shows the command line
>> used.
> And you didn't abort them or anything? Just let them upload? I tried the
> following just now with regular password and it worked fine:

Just let them upload. I just toggle between curl-7.18.1 and curl-7.18.2 and I
get the different behaviors from

valgrind --tool=memcheck --num-callers=60 --leak-check=full --freelist-vol=5000000 --show-reachable=yes
curl -v --netrc-optional -T "{/etc/termcap,/etc/passwd}" sftp://myhost/~/tmp/

I noticed 1 key difference in the verbose output from the 2 outputs.
curl-7.18.1 verbose output ends with:

    Connection #0 to host myhost left intact

    * SSH DISCONNECT starts now
    * SFTP 0x4368f88 state change from SSH_STOP to SSH_SFTP_SHUTDOWN
    * SFTP 0x4368f88 state change from SSH_SFTP_SHUTDOWN to SSH_SESSION_DISCONNECT
    * SFTP 0x4368f88 state change from SSH_SESSION_DISCONNECT to SSH_SESSION_FREE
    * SFTP 0x4368f88 state change from SSH_SESSION_FREE to SSH_STOP
    * SSH DISCONNECT is done
    * Closing connection #0

However, curl-7.18.2 verbose output ends with only:

    Connection #0 to host myhost left intact

and only the curl-7.18.2 valgrind output has this memory leak:

==00:00:00:22.951 15088== 8,904 (6,602 direct, 2,302 indirect) bytes in 6
 are definitely lost in loss record 8 of 9
 ==00:00:00:22.952 15088== at 0x401B504: malloc (vg_replace_malloc.c:149)
 ==00:00:00:22.952 15088== by 0x404E753: curl_domalloc (memdebug.c:136)
 ==00:00:00:22.952 15088== by 0x405BAF0: libssh2_malloc (ssh.c:278)
 ==00:00:00:22.952 15088== by 0x4200847: libssh2_session_init_ex
 ==00:00:00:22.952 15088== by 0x405F841: ssh_connect (ssh.c:2052)
 ==00:00:00:22.952 15088== by 0x40409A6: Curl_protocol_connect (url.c:2803)
 ==00:00:00:22.952 15088== by 0x4042D11: SetupConnection (url.c:4289)
 ==00:00:00:22.952 15088== by 0x4042E53: Curl_connect (url.c:4363)
 ==00:00:00:22.952 15088== by 0x404CF75: connect_host (transfer.c:2291)
 ==00:00:00:22.952 15088== by 0x404D11B: Curl_perform (transfer.c:2372)
 ==00:00:00:22.953 15088== by 0x404DB34: curl_easy_perform (easy.c:520)
 ==00:00:00:22.953 15088== by 0x80515B8: operate (main.c:4692)
 ==00:00:00:22.953 15088== by 0x8051DF6: main (main.c:5000)

So, it appears my curl-7.18.2 test is not doing the appropriate orderly

My application built with libcurl behaves exactly like the the curl command
line tool.


“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-06-12