1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-11-30 13:01:23 +03:00

auth: Fix a memory leak in ssh_userauth_agent_publickey()

CID 1230358

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
Andreas Schneider
2018-09-01 09:32:35 +02:00
parent 8323cd791f
commit ea2b403ab2

View File

@@ -729,6 +729,7 @@ static int ssh_userauth_agent_publickey(ssh_session session,
"The key algorithm '%s' is not allowed to be used by" "The key algorithm '%s' is not allowed to be used by"
" PUBLICKEY_ACCEPTED_TYPES configuration option", " PUBLICKEY_ACCEPTED_TYPES configuration option",
sig_type_c); sig_type_c);
ssh_string_free(str);
return SSH_AUTH_DENIED; return SSH_AUTH_DENIED;
} }
@@ -742,12 +743,11 @@ static int ssh_userauth_agent_publickey(ssh_session session,
sig_type_c, /* algo */ sig_type_c, /* algo */
str /* public key */ str /* public key */
); );
ssh_string_free(str);
if (rc < 0) { if (rc < 0) {
goto fail; goto fail;
} }
ssh_string_free(str);
/* sign the buffer with the private key */ /* sign the buffer with the private key */
str = ssh_pki_do_sign_agent(session, session->out_buffer, pubkey); str = ssh_pki_do_sign_agent(session, session->out_buffer, pubkey);
if (str == NULL) { if (str == NULL) {