mirror of
https://github.com/moparisthebest/curl
synced 2024-12-22 08:08:50 -05:00
SFTP: gracefully handle shutdown early
When using the multi interface and a handle using SFTP was removed very early on, we would get a segfault due to the code assumed data was there that hadn't yet been setup. Bug: http://curl.haxx.se/mail/lib-2011-03/0066.html Reported by: Saqib Ali
This commit is contained in:
parent
c042340b2a
commit
60172a0446
12
lib/ssh.c
12
lib/ssh.c
@ -2047,8 +2047,10 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
|
|||||||
}
|
}
|
||||||
sshc->sftp_handle = NULL;
|
sshc->sftp_handle = NULL;
|
||||||
}
|
}
|
||||||
Curl_safefree(sftp_scp->path);
|
if(sftp_scp) {
|
||||||
sftp_scp->path = NULL;
|
Curl_safefree(sftp_scp->path);
|
||||||
|
sftp_scp->path = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
DEBUGF(infof(data, "SFTP DONE done\n"));
|
DEBUGF(infof(data, "SFTP DONE done\n"));
|
||||||
#if 0 /* PREV */
|
#if 0 /* PREV */
|
||||||
@ -2752,8 +2754,10 @@ static CURLcode ssh_done(struct connectdata *conn, CURLcode status)
|
|||||||
else
|
else
|
||||||
result = status;
|
result = status;
|
||||||
|
|
||||||
Curl_safefree(sftp_scp->path);
|
if(sftp_scp) {
|
||||||
sftp_scp->path = NULL;
|
Curl_safefree(sftp_scp->path);
|
||||||
|
sftp_scp->path = NULL;
|
||||||
|
}
|
||||||
Curl_pgrsDone(conn);
|
Curl_pgrsDone(conn);
|
||||||
|
|
||||||
conn->data->req.keepon = 0; /* clear all bits */
|
conn->data->req.keepon = 0; /* clear all bits */
|
||||||
|
Loading…
Reference in New Issue
Block a user