libssh2: remove use of 'initialised' for cleanup

It could previously cause a memory-leak when the cleanup was not
performed because it was not set.

Reported-by: albrechtd on github
Fixes #17819
Closes #17837
This commit is contained in:
Daniel Stenberg 2025-07-07 08:23:15 +02:00
parent 22bd59fb7f
commit f048546c87
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
2 changed files with 94 additions and 96 deletions

View file

@ -191,6 +191,7 @@ struct ssh_conn {
const char *readdir_filename; /* points within readdir_attrs */
const char *readdir_longentry;
char *readdir_tmp;
BIT(initialised);
#elif defined(USE_LIBSSH2)
LIBSSH2_SESSION *ssh_session; /* Secure Shell session */
LIBSSH2_CHANNEL *ssh_channel; /* Secure Shell channel handle */
@ -214,8 +215,8 @@ struct ssh_conn {
word32 handleSz;
byte handle[WOLFSSH_MAX_HANDLE];
curl_off_t offset;
#endif /* USE_LIBSSH */
BIT(initialised);
#endif /* USE_LIBSSH */
BIT(authed); /* the connection has been authenticated fine */
BIT(acceptfail); /* used by the SFTP_QUOTE (continue if
quote command fails) */