mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-22 14:57:02 +01:00
g10: Fix memory leak for --card-status.
* g10/card-util.c (card_status): Release memory of serial number. -- Cherry pick of master commit: fe8b6339542f3b1228b5fd56fc710ea3b07a3a2b Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
parent
c5aba093b8
commit
293001e2c6
@ -667,7 +667,7 @@ card_status (ctrl_t ctrl, estream_t fp, const char *serialno)
|
|||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
strlist_t card_list, sl;
|
strlist_t card_list, sl;
|
||||||
char *serialno0;
|
char *serialno0, *serialno1;
|
||||||
int all_cards = 0;
|
int all_cards = 0;
|
||||||
|
|
||||||
if (serialno == NULL)
|
if (serialno == NULL)
|
||||||
@ -693,8 +693,6 @@ card_status (ctrl_t ctrl, estream_t fp, const char *serialno)
|
|||||||
|
|
||||||
for (sl = card_list; sl; sl = sl->next)
|
for (sl = card_list; sl; sl = sl->next)
|
||||||
{
|
{
|
||||||
char *serialno1;
|
|
||||||
|
|
||||||
if (!all_cards && strcmp (serialno, sl->d))
|
if (!all_cards && strcmp (serialno, sl->d))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -715,7 +713,8 @@ card_status (ctrl_t ctrl, estream_t fp, const char *serialno)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Select the original card again. */
|
/* Select the original card again. */
|
||||||
err = agent_scd_serialno (&serialno0, serialno0);
|
err = agent_scd_serialno (&serialno1, serialno0);
|
||||||
|
xfree (serialno1);
|
||||||
|
|
||||||
leave:
|
leave:
|
||||||
xfree (serialno0);
|
xfree (serialno0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user