From 05f37c099d404f961e64af5c8f41196d4e0514d6 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Sun, 21 Mar 2021 00:10:04 +0100 Subject: libssh2: clear session pointer after free If libssh2_knownhost_init() returns NULL, like in an OOM situation, the ssh session was freed but the pointer wasn't cleared which made libcurl later call libssh2 to cleanup using the stale pointer. Fixes #6764 Closes # --- lib/vssh/libssh2.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/vssh/libssh2.c b/lib/vssh/libssh2.c index 0e7c2eb98..891e945f7 100644 --- a/lib/vssh/libssh2.c +++ b/lib/vssh/libssh2.c @@ -3159,6 +3159,7 @@ static CURLcode ssh_connect(struct Curl_easy *data, bool *done) sshc->kh = libssh2_knownhost_init(sshc->ssh_session); if(!sshc->kh) { libssh2_session_free(sshc->ssh_session); + sshc->ssh_session = NULL; return CURLE_FAILED_INIT; } -- cgit v1.2.1