summaryrefslogtreecommitdiffstats
path: root/scd
diff options
context:
space:
mode:
authorNIIBE Yutaka <gniibe@fsij.org>2020-09-28 06:33:20 +0200
committerNIIBE Yutaka <gniibe@fsij.org>2020-09-28 06:33:20 +0200
commitc5e8ef3ab980012b64f5894f437e2ff568b02f43 (patch)
tree1c2d98f728ea139d2116d2f3e8b1a844268bd02d /scd
parentscd: Change handling of SPR532 card reader. (diff)
downloadgnupg2-c5e8ef3ab980012b64f5894f437e2ff568b02f43.tar.xz
gnupg2-c5e8ef3ab980012b64f5894f437e2ff568b02f43.zip
scd: Internal CCID: Clear the handle after use.
* scd/apdu.c (close_ccid_reader): Clear the handle. (open_ccid_reader): Likewise. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
Diffstat (limited to 'scd')
-rw-r--r--scd/apdu.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/scd/apdu.c b/scd/apdu.c
index 008842a55..a29305556 100644
--- a/scd/apdu.c
+++ b/scd/apdu.c
@@ -1451,6 +1451,7 @@ static int
close_ccid_reader (int slot)
{
ccid_close_reader (reader_table[slot].ccid.handle);
+ reader_table[slot].ccid.handle = NULL;
return 0;
}
@@ -1613,7 +1614,10 @@ open_ccid_reader (struct dev_list *dl, int *r_cciderr)
err = ccid_get_atr (slotp->ccid.handle,
slotp->atr, sizeof slotp->atr, &slotp->atrlen);
if (err)
- ccid_close_reader (slotp->ccid.handle);
+ {
+ ccid_close_reader (slotp->ccid.handle);
+ slotp->ccid.handle = NULL;
+ }
}
if (err)