diff options
author | Daniel Stenberg <daniel@haxx.se> | 2021-03-21 00:10:04 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2021-03-21 00:10:04 +0100 |
commit | 05f37c099d404f961e64af5c8f41196d4e0514d6 (patch) | |
tree | ade843f30d65752166b58007fb3374d2bc9e5360 | |
parent | 472b537215984cd0d153055a0cd6b3ccc2f387e5 (diff) | |
download | curl-bagder/libssh2-session-free.tar.gz |
libssh2: clear session pointer after freebagder/libssh2-session-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 #
-rw-r--r-- | lib/vssh/libssh2.c | 1 |
1 files changed, 1 insertions, 0 deletions
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; } |