mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-03 12:11:33 +01:00
g10: Fix memory leak (more).
* g10/skclist.c (enum_secret_keys): Free SERIALNO on update. -- Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
parent
64c5c45e2a
commit
2eb481e8cc
@ -380,6 +380,8 @@ enum_secret_keys (ctrl_t ctrl, void **context, PKT_public_key *sk)
|
|||||||
/* Loop over the list of secret keys. */
|
/* Loop over the list of secret keys. */
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
char *serialno;
|
||||||
|
|
||||||
name = NULL;
|
name = NULL;
|
||||||
keyblock = NULL;
|
keyblock = NULL;
|
||||||
switch (c->state)
|
switch (c->state)
|
||||||
@ -415,8 +417,6 @@ enum_secret_keys (ctrl_t ctrl, void **context, PKT_public_key *sk)
|
|||||||
case 4: /* Get next item from card list. */
|
case 4: /* Get next item from card list. */
|
||||||
if (c->sl)
|
if (c->sl)
|
||||||
{
|
{
|
||||||
char *serialno;
|
|
||||||
|
|
||||||
err = agent_scd_serialno (&serialno, c->sl->d);
|
err = agent_scd_serialno (&serialno, c->sl->d);
|
||||||
if (err)
|
if (err)
|
||||||
{
|
{
|
||||||
@ -444,9 +444,13 @@ enum_secret_keys (ctrl_t ctrl, void **context, PKT_public_key *sk)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (c->serialno)
|
serialno = c->serialno;
|
||||||
/* Select the original card again. */
|
if (serialno)
|
||||||
agent_scd_serialno (&c->serialno, c->serialno);
|
{
|
||||||
|
/* Select the original card again. */
|
||||||
|
agent_scd_serialno (&c->serialno, serialno);
|
||||||
|
xfree (serialno);
|
||||||
|
}
|
||||||
c->state++;
|
c->state++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user