Skip to content

Commit

Permalink
libssh: free sftp_canonicalize_path() data correctly
Browse files Browse the repository at this point in the history
Fixes #3402
Closes #3403
  • Loading branch information
bagder committed Dec 21, 2018
1 parent 006ff62 commit 6ec3b69
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions lib/ssh-libssh.c
Expand Up @@ -1661,7 +1661,7 @@ static CURLcode myssh_statemach_act(struct connectdata *conn, bool *block)
sshc->sftp_session = NULL;
}

Curl_safefree(sshc->homedir);
SSH_STRING_FREE_CHAR(sshc->homedir);
conn->data->state.most_recent_ftp_entrypath = NULL;

state(conn, SSH_SESSION_DISCONNECT);
Expand Down Expand Up @@ -1829,7 +1829,7 @@ static CURLcode myssh_statemach_act(struct connectdata *conn, bool *block)

ssh_disconnect(sshc->ssh_session);

Curl_safefree(sshc->homedir);
SSH_STRING_FREE_CHAR(sshc->homedir);
conn->data->state.most_recent_ftp_entrypath = NULL;

state(conn, SSH_SESSION_FREE);
Expand Down Expand Up @@ -1866,14 +1866,11 @@ static CURLcode myssh_statemach_act(struct connectdata *conn, bool *block)

Curl_safefree(sshc->rsa_pub);
Curl_safefree(sshc->rsa);

Curl_safefree(sshc->quote_path1);
Curl_safefree(sshc->quote_path2);

Curl_safefree(sshc->homedir);

Curl_safefree(sshc->readdir_line);
Curl_safefree(sshc->readdir_linkPath);
SSH_STRING_FREE_CHAR(sshc->homedir);

/* the code we are about to return */
result = sshc->actualcode;
Expand Down

0 comments on commit 6ec3b69

Please sign in to comment.