mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
gpg: Fix minor memory leak during certain smartcard operations.
* g10/keygen.c (card_store_key_with_backup): Fix memory leak on error.
This commit is contained in:
parent
a4fe307b55
commit
95b9a31f81
13
g10/keygen.c
13
g10/keygen.c
@ -5386,17 +5386,26 @@ card_store_key_with_backup (ctrl_t ctrl, PKT_public_key *sub_psk,
|
|||||||
{
|
{
|
||||||
ecdh_param_str = ecdh_param_str_from_pk (sk);
|
ecdh_param_str = ecdh_param_str_from_pk (sk);
|
||||||
if (!ecdh_param_str)
|
if (!ecdh_param_str)
|
||||||
return gpg_error_from_syserror ();
|
{
|
||||||
|
free_public_key (sk);
|
||||||
|
return gpg_error_from_syserror ();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
err = hexkeygrip_from_pk (sk, &hexgrip);
|
err = hexkeygrip_from_pk (sk, &hexgrip);
|
||||||
if (err)
|
if (err)
|
||||||
goto leave;
|
{
|
||||||
|
xfree (ecdh_param_str);
|
||||||
|
free_public_key (sk);
|
||||||
|
goto leave;
|
||||||
|
}
|
||||||
|
|
||||||
memset(&info, 0, sizeof (info));
|
memset(&info, 0, sizeof (info));
|
||||||
rc = agent_scd_getattr ("SERIALNO", &info);
|
rc = agent_scd_getattr ("SERIALNO", &info);
|
||||||
if (rc)
|
if (rc)
|
||||||
{
|
{
|
||||||
|
xfree (ecdh_param_str);
|
||||||
|
free_public_key (sk);
|
||||||
err = (gpg_error_t)rc;
|
err = (gpg_error_t)rc;
|
||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user