mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
agent: Avoid memory leak when handling ssh keys.
* agent/command-ssh.c (ssh_send_available_keys): Close file and directory on error paths. -- GnuPG-bug-id: 7201 Signed-off-by: Jakub Jelen <jjelen@redhat.com>
This commit is contained in:
parent
be40a33419
commit
dd23441938
@ -2602,6 +2602,7 @@ ssh_send_available_keys (ctrl_t ctrl, estream_t key_blobs, u32 *r_key_counter)
|
|||||||
if (!dirname)
|
if (!dirname)
|
||||||
{
|
{
|
||||||
err = gpg_error_from_syserror ();
|
err = gpg_error_from_syserror ();
|
||||||
|
ssh_close_control_file (cf);
|
||||||
agent_card_free_keyinfo (keyinfo_on_cards);
|
agent_card_free_keyinfo (keyinfo_on_cards);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
@ -2610,6 +2611,7 @@ ssh_send_available_keys (ctrl_t ctrl, estream_t key_blobs, u32 *r_key_counter)
|
|||||||
{
|
{
|
||||||
err = gpg_error_from_syserror ();
|
err = gpg_error_from_syserror ();
|
||||||
xfree (dirname);
|
xfree (dirname);
|
||||||
|
ssh_close_control_file (cf);
|
||||||
agent_card_free_keyinfo (keyinfo_on_cards);
|
agent_card_free_keyinfo (keyinfo_on_cards);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
@ -2714,6 +2716,8 @@ ssh_send_available_keys (ctrl_t ctrl, estream_t key_blobs, u32 *r_key_counter)
|
|||||||
err = add_to_key_array (&keyarray, key_public, cardsn, order);
|
err = add_to_key_array (&keyarray, key_public, cardsn, order);
|
||||||
if (err)
|
if (err)
|
||||||
{
|
{
|
||||||
|
gnupg_closedir (dir);
|
||||||
|
ssh_close_control_file (cf);
|
||||||
gcry_sexp_release (key_public);
|
gcry_sexp_release (key_public);
|
||||||
xfree (cardsn);
|
xfree (cardsn);
|
||||||
goto leave;
|
goto leave;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user