aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2017-12-02 23:27:22 +0100
committerDaniel Stenberg <daniel@haxx.se>2017-12-02 23:36:07 +0100
commit3cef6f22eae7b7e60c19689d0f07492c700a8e0f (patch)
tree7125bea08ad6d0ea18e848877ea941d573db480f
parent10bb0b47197588f2491a16996ae3d95e37a4ee20 (diff)
libssh: fix minor static code analyzer nits
- remove superfluous NULL check which otherwise tricks the static code analyzers to assume NULL pointer dereferences. - fix fallthrough in switch() - indent mistake
-rw-r--r--lib/ssh-libssh.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/lib/ssh-libssh.c b/lib/ssh-libssh.c
index 732aad7fa..8856d9044 100644
--- a/lib/ssh-libssh.c
+++ b/lib/ssh-libssh.c
@@ -325,8 +325,8 @@ static int myssh_is_known(struct connectdata *conn)
if(hlen != strlen(data->set.str[STRING_SSH_HOST_PUBLIC_KEY_MD5]) ||
memcmp(&data->set.str[STRING_SSH_HOST_PUBLIC_KEY_MD5], hash, hlen)) {
- rc = SSH_ERROR;
- goto cleanup;
+ rc = SSH_ERROR;
+ goto cleanup;
}
rc = SSH_OK;
@@ -342,11 +342,15 @@ static int myssh_is_known(struct connectdata *conn)
switch(vstate) {
case SSH_SERVER_KNOWN_OK:
keymatch = CURLKHMATCH_OK;
+ break;
case SSH_SERVER_FILE_NOT_FOUND:
+ /* fallthrough */
case SSH_SERVER_NOT_KNOWN:
keymatch = CURLKHMATCH_MISSING;
- default:
+ break;
+ default:
keymatch = CURLKHMATCH_MISMATCH;
+ break;
}
if(func) { /* use callback to determine action */
@@ -994,8 +998,8 @@ static CURLcode myssh_statemach_act(struct connectdata *conn, bool *block)
if(statvfs != 0 && !sshc->acceptfail) {
Curl_safefree(sshc->quote_path1);
err = sftp_get_error(sshc->sftp_session);
- failf(data, "statvfs command failed: %s",
- ssh_get_error(sshc->ssh_session));
+ failf(data, "statvfs command failed: %s (%d)",
+ ssh_get_error(sshc->ssh_session), err);
state(conn, SSH_SFTP_CLOSE);
sshc->nextstate = SSH_NO_STATE;
sshc->actualcode = CURLE_QUOTE_ERROR;
@@ -1620,8 +1624,7 @@ static CURLcode myssh_statemach_act(struct connectdata *conn, bool *block)
sftp_close(sshc->sftp_file);
sshc->sftp_file = NULL;
}
- if(protop)
- Curl_safefree(protop->path);
+ Curl_safefree(protop->path);
DEBUGF(infof(data, "SFTP DONE done\n"));