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

scd: Fix close_pcsc_reader.

* scd/apdu.c (close_pcsc_reader): Don't touch .RDRNAME field.
(apdu_dev_list_finish): Clear .RDRNAME field and replace call of
close_pcsc_reader by release_pcsc_context.  Add assertion.

--

GnuPG-bug-id: 5416
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
NIIBE Yutaka 2021-05-10 10:49:21 +09:00
parent cccc9bd5db
commit ec5591dc4e

View File

@ -842,14 +842,7 @@ close_pcsc_reader (int slot)
(void)slot;
log_assert (pcsc.count > 0);
if (!--pcsc.count)
{
int i;
/*log_debug ("%s: releasing context\n", __func__);*/
release_pcsc_context ();
for (i = 0; i < MAX_READER; i++)
pcsc.rdrname[i] = NULL;
}
release_pcsc_context ();
return 0;
}
@ -2123,8 +2116,15 @@ apdu_dev_list_finish (struct dev_list *dl)
else
#endif
{ /* PC/SC readers. */
int i;
xfree (dl->table);
close_pcsc_reader (0);
for (i = 0; i < MAX_READER; i++)
pcsc.rdrname[i] = NULL;
log_assert (pcsc.count > 0);
if (--pcsc.count == 0)
release_pcsc_context ();
}
xfree (dl);
}