mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-03 22:56:33 +02:00
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 <jjelen@redhat.com> Changed original patch to not add a free before a GPG_ERR_BUG. Signed-off-by: Werner Koch <wk@gnupg.org> GnuPG-bug-id: 5393
This commit is contained in:
parent
a660e10606
commit
a95ddffdcd
6 changed files with 23 additions and 8 deletions
|
@ -319,6 +319,7 @@ read_key (const char *fname)
|
|||
if (buflen >= 4 && !memcmp (buf, "Key:", 4))
|
||||
{
|
||||
log_error ("Extended key format is not supported by this tool\n");
|
||||
xfree (buf);
|
||||
return NULL;
|
||||
}
|
||||
key = make_canonical (fname, buf, buflen);
|
||||
|
@ -793,7 +794,10 @@ agent_askpin (ctrl_t ctrl,
|
|||
passphrase = get_passphrase (0);
|
||||
size = strlen (passphrase);
|
||||
if (size >= pininfo->max_length)
|
||||
return gpg_error (GPG_ERR_TOO_LARGE);
|
||||
{
|
||||
xfree (passphrase);
|
||||
return gpg_error (GPG_ERR_TOO_LARGE);
|
||||
}
|
||||
|
||||
memcpy (&pininfo->pin, passphrase, size);
|
||||
xfree (passphrase);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue