diff options
author | Jakub Jelen <[email protected]> | 2021-05-20 08:13:51 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2021-05-20 11:38:07 +0000 |
commit | a95ddffdcd58383cce93677be5e7e11c5c229a98 (patch) | |
tree | 3705ec520ecc77efa85f07a85c66b47e9b162dca /agent/genkey.c | |
parent | dirmngr: For KS_SEARCH return the fingerprint also with LDAP. (diff) | |
download | gnupg-a95ddffdcd58383cce93677be5e7e11c5c229a98.tar.gz gnupg-a95ddffdcd58383cce93677be5e7e11c5c229a98.zip |
agent: Avoid memory leaks in error code paths.
* agent/command.c (cmd_genkey): Use goto instead of return.
* agent/cvt-openpgp.c (convert_from_openpgp_main): Ditto.
* agent/genkey.c (agent_ask_new_passphrase): Fix typo to free correct
pointer
(agent_genkey): Release memory
* agent/gpg-agent.c (check_own_socket): Free sockname
* agent/protect-tool.c (read_key): Free buf.
(agent_askpin): Free passphrase
--
Signed-off-by: Jakub Jelen <[email protected]>
Changed original patch to not add a free before a GPG_ERR_BUG.
Signed-off-by: Werner Koch <[email protected]>
GnuPG-bug-id: 5393
Diffstat (limited to 'agent/genkey.c')
-rw-r--r-- | agent/genkey.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/agent/genkey.c b/agent/genkey.c index 9b47f0fac..c7cfc6910 100644 --- a/agent/genkey.c +++ b/agent/genkey.c @@ -363,7 +363,7 @@ agent_ask_new_passphrase (ctrl_t ctrl, const char *prompt, if (!pi2) { err = gpg_error_from_syserror (); - xfree (pi2); + xfree (pi); return err; } pi->max_length = MAX_PASSPHRASE_LEN + 1; @@ -465,7 +465,10 @@ agent_genkey (ctrl_t ctrl, const char *cache_nonce, time_t timestamp, "protect your new key"), &passphrase_buffer); if (rc) - return rc; + { + gcry_sexp_release (s_keyparam); + return rc; + } passphrase = passphrase_buffer; } |