From ea2b403ab236b3b8f895f9affbc8f162ee61ddb2 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Sat, 1 Sep 2018 09:32:35 +0200 Subject: [PATCH] auth: Fix a memory leak in ssh_userauth_agent_publickey() CID 1230358 Signed-off-by: Andreas Schneider --- src/auth.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/auth.c b/src/auth.c index c1bb2cc5..f72c4373 100644 --- a/src/auth.c +++ b/src/auth.c @@ -729,6 +729,7 @@ static int ssh_userauth_agent_publickey(ssh_session session, "The key algorithm '%s' is not allowed to be used by" " PUBLICKEY_ACCEPTED_TYPES configuration option", sig_type_c); + ssh_string_free(str); return SSH_AUTH_DENIED; } @@ -742,12 +743,11 @@ static int ssh_userauth_agent_publickey(ssh_session session, sig_type_c, /* algo */ str /* public key */ ); + ssh_string_free(str); if (rc < 0) { goto fail; } - ssh_string_free(str); - /* sign the buffer with the private key */ str = ssh_pki_do_sign_agent(session, session->out_buffer, pubkey); if (str == NULL) {