curl-library
Re: curl_multi_remove_handle() crashes if called before transfers are complete.
Date: Wed, 9 Mar 2011 15:46:37 -0800
On Wed, Mar 09, 2011 at 06:28:40PM -0500, Saqib Ali wrote:
> Below is the relevant output from dbx when I compiled the code with -g. This
> code works fine about 50% of the time. Then breaks about the other 50% of the
> time. So it seems like its a bad memory location. See below.
>
>
> t_at_1 (l_at_1) signal SEGV (no mapping at the fault address) in ssh_statemach_act at
> line 2036 in file "ssh.c"
> 2036 Curl_safefree(sftp_scp->path);
Looks like the ssh struct is being freed too soon. I haven't tested it, but
something like this patch should help:
diff --git a/lib/ssh.c b/lib/ssh.c
index 1aaa112..bfc36f7 100644
--- a/lib/ssh.c
+++ b/lib/ssh.c
@@ -2879,14 +2879,13 @@ static CURLcode sftp_disconnect(struct connectdata *conn, bool dead_connection)
DEBUGF(infof(conn->data, "SSH DISCONNECT starts now\n"));
- Curl_safefree(conn->data->state.proto.ssh);
- conn->data->state.proto.ssh = NULL;
-
if(conn->proto.sshc.ssh_session) {
/* only if there's a session still around to use! */
state(conn, SSH_SFTP_SHUTDOWN);
result = ssh_easy_statemach(conn, FALSE);
}
+ Curl_safefree(conn->data->state.proto.ssh);
+ conn->data->state.proto.ssh = NULL;
DEBUGF(infof(conn->data, "SSH DISCONNECT is done\n"));
>>> Dan
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-03-10