]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
libssh2: free fingerprint better
authorDaniel Stenberg <daniel@haxx.se>
Mon, 8 May 2023 12:33:54 +0000 (14:33 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 8 May 2023 14:47:03 +0000 (16:47 +0200)
Reported-by: Wei Chong Tan
Closes #11088

lib/vssh/libssh2.c

index bfcc94e16017833ba4f2cadcce49c7218c9d0974..dd39a844c646b905003e6b1605039af13cce9f3e 100644 (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;