]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
libssh: fix double close
authorJay Dommaschk <j.dommaschk@instar.de>
Wed, 20 Apr 2022 07:11:41 +0000 (09:11 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 20 Apr 2022 07:12:36 +0000 (09:12 +0200)
libssh closes the socket in ssh_diconnect() so make sure that libcurl
does not also close it.

Fixes #8708
Closes #8718

lib/vssh/libssh.c

index 617788c7f739b9333216e2423bde4cf5cc047ac1..7bf2b0417619614639c92337d1f8b29337ebc32f 100644 (file)
@@ -1970,6 +1970,10 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
       }
 
       ssh_disconnect(sshc->ssh_session);
+      /* conn->sock[FIRSTSOCKET] is closed by ssh_disconnect behind our back,
+         explicitly mark it as closed with the memdebug macro: */
+      fake_sclose(conn->sock[FIRSTSOCKET]);
+      conn->sock[FIRSTSOCKET] = CURL_SOCKET_BAD;
 
       SSH_STRING_FREE_CHAR(sshc->homedir);
       data->state.most_recent_ftp_entrypath = NULL;