libssh2: free fingerprint better

Reported-by: Wei Chong Tan
Closes #11088
This commit is contained in:
Daniel Stenberg 2023-05-08 14:33:54 +02:00
parent 5d36bdf490
commit 8e21b1a05f
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2

View file

@ -728,11 +728,10 @@ static CURLcode ssh_check_fingerprint(struct Curl_easy *data)
*/
if((pub_pos != b64_pos) ||
strncmp(fingerprint_b64, pubkey_sha256, pub_pos)) {
free(fingerprint_b64);
failf(data,
"Denied establishing ssh session: mismatch sha256 fingerprint. "
"Remote %s is not equal to %s", fingerprint_b64, pubkey_sha256);
free(fingerprint_b64);
state(data, SSH_SESSION_FREE);
sshc->actualcode = CURLE_PEER_FAILED_VERIFICATION;
return sshc->actualcode;