diff --git a/src/sftp.c b/src/sftp.c index 6ede3111..b39efa9d 100644 --- a/src/sftp.c +++ b/src/sftp.c @@ -793,7 +793,7 @@ static LIBSSH2_SFTP *sftp_init(LIBSSH2_SESSION *session) * The 'sftpInit_sftp' and 'sftpInit_channel' struct fields within the * session struct are only to be used during the setup phase. As soon * as the SFTP session is created they are cleared and can thus be - * re-used again to allow any amount of SFTP handles per sessions. + * reused again to allow any amount of SFTP handles per sessions. * * Note that you MUST NOT try to call libssh2_sftp_init() again to get * another handle until the previous call has finished and either diff --git a/src/userauth.c b/src/userauth.c index 0040c3fa..81bc038a 100644 --- a/src/userauth.c +++ b/src/userauth.c @@ -82,6 +82,10 @@ static char *userauth_list(LIBSSH2_SESSION *session, const char *username, session->userauth_list_data_len = username_len + 27; + if(!session->userauth_list_data) { + LIBSSH2_FREE(session, session->userauth_list_data); + } + s = session->userauth_list_data = LIBSSH2_ALLOC(session, session->userauth_list_data_len); if(!session->userauth_list_data) { @@ -154,6 +158,11 @@ static char *userauth_list(LIBSSH2_SESSION *session, const char *username, "Unexpected userauth banner size"); return NULL; } + + if(!session->userauth_banner) { + LIBSSH2_FREE(session, session->userauth_banner); + } + session->userauth_banner = LIBSSH2_ALLOC(session, banner_len + 1); if(!session->userauth_banner) { LIBSSH2_FREE(session, session->userauth_list_data); @@ -1612,7 +1621,7 @@ retry_auth: * * Note that the 'pubkeydata_len' extra bytes allocated here will not * be used in this first send, but will be used in the later one where - * this same allocation is re-used. + * this same allocation is reused. */ s = session->userauth_pblc_packet = LIBSSH2_ALLOC(session,