cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Segmentation fault???

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Mon, 24 Nov 2008 22:43:46 -0800

On Mon, Nov 24, 2008 at 11:35:40PM -0500, Wei Weng wrote:
> I have the backtrace.

The backtrace tells you all you need to know about the cause of the crash:

> #3 0xb7e487a5 in _IO_file_xsputn () from /lib/tls/i686/cmov/libc.so.6
> #4 0xb7e3e60a in fwrite () from /lib/tls/i686/cmov/libc.so.6
                    ^^^^^^
> #5 0xb7f6a547 in showit (data=0x9654840, type=CURLINFO_HEADER_OUT,
> ptr=0xbfbbf6ec "QUIT\r\n", size=6) at sendf.c:715
> #6 0xb7f6a731 in Curl_debug (data=0x9654840, type=CURLINFO_HEADER_OUT,
                    ^^^^^^^^^^
> ptr=0xbfbbf6ec "QUIT\r\n", size=6, conn=0x965d4a0) at sendf.c:762
> #7 0xb7f70922 in Curl_nbftpsendf (conn=0x965d4a0, fmt=0xb7f9c72c "QUIT") at
> ftp.c:3701
> #8 0xb7f70c2b in ftp_quit (conn=0x965d4a0) at ftp.c:3797
> #9 0xb7f70c94 in ftp_disconnect (conn=0x965d4a0) at ftp.c:3826
> #10 0xb7f74be6 in Curl_disconnect (conn=0x965d4a0) at url.c:2195
> #11 0xb7f7547f in ConnectionKillOne (data=0x9654840) at url.c:2574
> #12 0xb7f7186b in close_connections (data=0x9654840) at url.c:249
> #13 0xb7f71b74 in Curl_close (data=0x9654840) at url.c:416
> #14 0xb7f89dc8 in curl_easy_cleanup (curl=0x9654840) at easy.c:552
                    ^^^^^^^^^^^^^^^^^
> #15 0x080488e6 in main ()

It happens in the call to curl_easy_cleanup() from your code (in main).
The actual crash is due to the call to fwrite() which occurs while writing
debug output.

Looking at the code shows that the stderr stream is being closed before the
call to curl_easy_cleanup.

>>> Dan

-- 
http://www.MoveAnnouncer.com              The web change of address service
          Let webmasters know that your web site has moved
Received on 2008-11-25