summaryrefslogtreecommitdiff
path: root/lib/vssh
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2021-03-21 00:10:04 +0100
committerDaniel Stenberg <daniel@haxx.se>2021-03-21 11:22:08 +0100
commit012c19c33a57bd821aa433b488deaf7f30e7bb44 (patch)
treefe10122199ebb22cb3d138532ff2409631eab3ad /lib/vssh
parent2e444a17d4ae3976ea69865dd2a63ba0fb40267f (diff)
downloadcurl-012c19c33a57bd821aa433b488deaf7f30e7bb44.tar.gz
libssh2:ssh_connect: 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 #6766
Diffstat (limited to 'lib/vssh')
-rw-r--r--lib/vssh/libssh2.c1
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;
}