aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNIIBE Yutaka <[email protected]>2020-07-17 11:42:38 +0000
committerNIIBE Yutaka <[email protected]>2020-07-17 11:42:38 +0000
commitdaa2cec6a543f06a2e408d97a80a5041027f16a9 (patch)
tree59fdbeaa8ea73565a50d0fbc62d01a750ddb5bb2
parentUse gpgrt's new option parser for symcryptrun. (diff)
downloadgnupg-daa2cec6a543f06a2e408d97a80a5041027f16a9.tar.gz
gnupg-daa2cec6a543f06a2e408d97a80a5041027f16a9.zip
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 <[email protected]>
-rw-r--r--scd/apdu.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/scd/apdu.c b/scd/apdu.c
index 33951a2da..8b3b5694c 100644
--- a/scd/apdu.c
+++ b/scd/apdu.c
@@ -821,6 +821,7 @@ close_pcsc_reader (int slot)
pcsc.context = 0;
for (i = 0; i < MAX_READER; i++)
pcsc.rdrname[i] = NULL;
+ npth_mutex_unlock (&reader_table_lock);
}
return 0;
}
@@ -2061,6 +2062,12 @@ apdu_dev_list_finish (struct dev_list *dl)
xfree (dl->table);
for (i = 0; i < MAX_READER; i++)
pcsc.rdrname[i] = NULL;
+
+ if (pcsc.count == 0)
+ {
+ pcsc_release_context (pcsc.context);
+ pcsc.context = 0;
+ }
}
xfree (dl);
npth_mutex_unlock (&reader_table_lock);