mirror of
https://github.com/moparisthebest/curl
synced 2024-12-24 17:18:48 -05:00
libssh: free sftp_canonicalize_path() data correctly
Assisted-by: Harry Sintonen Fixes #3402 Closes #3403
This commit is contained in:
parent
207e7cfa98
commit
d18a5afaf0
@ -95,6 +95,13 @@
|
|||||||
#include "memdebug.h"
|
#include "memdebug.h"
|
||||||
#include "curl_path.h"
|
#include "curl_path.h"
|
||||||
|
|
||||||
|
/* A recent macro provided by libssh. Or make our own. */
|
||||||
|
#ifndef SSH_STRING_FREE_CHAR
|
||||||
|
/* !checksrc! disable ASSIGNWITHINCONDITION 1 */
|
||||||
|
#define SSH_STRING_FREE_CHAR(x) \
|
||||||
|
do { if((x) != NULL) { ssh_string_free_char(x); x = NULL; } } while(0)
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Local functions: */
|
/* Local functions: */
|
||||||
static CURLcode myssh_connect(struct connectdata *conn, bool *done);
|
static CURLcode myssh_connect(struct connectdata *conn, bool *done);
|
||||||
static CURLcode myssh_multi_statemach(struct connectdata *conn,
|
static CURLcode myssh_multi_statemach(struct connectdata *conn,
|
||||||
@ -1661,7 +1668,7 @@ static CURLcode myssh_statemach_act(struct connectdata *conn, bool *block)
|
|||||||
sshc->sftp_session = NULL;
|
sshc->sftp_session = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Curl_safefree(sshc->homedir);
|
SSH_STRING_FREE_CHAR(sshc->homedir);
|
||||||
conn->data->state.most_recent_ftp_entrypath = NULL;
|
conn->data->state.most_recent_ftp_entrypath = NULL;
|
||||||
|
|
||||||
state(conn, SSH_SESSION_DISCONNECT);
|
state(conn, SSH_SESSION_DISCONNECT);
|
||||||
@ -1829,7 +1836,7 @@ static CURLcode myssh_statemach_act(struct connectdata *conn, bool *block)
|
|||||||
|
|
||||||
ssh_disconnect(sshc->ssh_session);
|
ssh_disconnect(sshc->ssh_session);
|
||||||
|
|
||||||
Curl_safefree(sshc->homedir);
|
SSH_STRING_FREE_CHAR(sshc->homedir);
|
||||||
conn->data->state.most_recent_ftp_entrypath = NULL;
|
conn->data->state.most_recent_ftp_entrypath = NULL;
|
||||||
|
|
||||||
state(conn, SSH_SESSION_FREE);
|
state(conn, SSH_SESSION_FREE);
|
||||||
@ -1866,14 +1873,11 @@ static CURLcode myssh_statemach_act(struct connectdata *conn, bool *block)
|
|||||||
|
|
||||||
Curl_safefree(sshc->rsa_pub);
|
Curl_safefree(sshc->rsa_pub);
|
||||||
Curl_safefree(sshc->rsa);
|
Curl_safefree(sshc->rsa);
|
||||||
|
|
||||||
Curl_safefree(sshc->quote_path1);
|
Curl_safefree(sshc->quote_path1);
|
||||||
Curl_safefree(sshc->quote_path2);
|
Curl_safefree(sshc->quote_path2);
|
||||||
|
|
||||||
Curl_safefree(sshc->homedir);
|
|
||||||
|
|
||||||
Curl_safefree(sshc->readdir_line);
|
Curl_safefree(sshc->readdir_line);
|
||||||
Curl_safefree(sshc->readdir_linkPath);
|
Curl_safefree(sshc->readdir_linkPath);
|
||||||
|
SSH_STRING_FREE_CHAR(sshc->homedir);
|
||||||
|
|
||||||
/* the code we are about to return */
|
/* the code we are about to return */
|
||||||
result = sshc->actualcode;
|
result = sshc->actualcode;
|
||||||
|
Loading…
Reference in New Issue
Block a user