1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

g10: Fix memory leak for --card-status.

* g10/card-util.c (card_status): Release memory of serial number.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
NIIBE Yutaka 2018-09-18 09:34:00 +09:00
parent 60c880bda5
commit fe8b633954

View File

@ -674,7 +674,7 @@ card_status (ctrl_t ctrl, estream_t fp, const char *serialno)
{
int err;
strlist_t card_list, sl;
char *serialno0;
char *serialno0, *serialno1;
int all_cards = 0;
if (serialno == NULL)
@ -700,8 +700,6 @@ card_status (ctrl_t ctrl, estream_t fp, const char *serialno)
for (sl = card_list; sl; sl = sl->next)
{
char *serialno1;
if (!all_cards && strcmp (serialno, sl->d))
continue;
@ -722,7 +720,8 @@ card_status (ctrl_t ctrl, estream_t fp, const char *serialno)
}
/* Select the original card again. */
err = agent_scd_serialno (&serialno0, serialno0);
err = agent_scd_serialno (&serialno1, serialno0);
xfree (serialno1);
leave:
xfree (serialno0);