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

scd: Fix closing reader and reeleasing context in PC/SC.

* scd/apdu.c (close_pcsc_reader): Unlock the reader_table_lock.
(apdu_dev_list_finish): Release the context when no readers.

--

Fixes-commit: 46d185f60397f68830bfdfb99627b29aea5016f1
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
NIIBE Yutaka 2020-07-17 20:42:38 +09:00
parent f484ac2b2d
commit daa2cec6a5

View File

@ -821,6 +821,7 @@ close_pcsc_reader (int slot)
pcsc.context = 0; pcsc.context = 0;
for (i = 0; i < MAX_READER; i++) for (i = 0; i < MAX_READER; i++)
pcsc.rdrname[i] = NULL; pcsc.rdrname[i] = NULL;
npth_mutex_unlock (&reader_table_lock);
} }
return 0; return 0;
} }
@ -2061,6 +2062,12 @@ apdu_dev_list_finish (struct dev_list *dl)
xfree (dl->table); xfree (dl->table);
for (i = 0; i < MAX_READER; i++) for (i = 0; i < MAX_READER; i++)
pcsc.rdrname[i] = NULL; pcsc.rdrname[i] = NULL;
if (pcsc.count == 0)
{
pcsc_release_context (pcsc.context);
pcsc.context = 0;
}
} }
xfree (dl); xfree (dl);
npth_mutex_unlock (&reader_table_lock); npth_mutex_unlock (&reader_table_lock);