[Pcsclite-cvs-commit] r1807 - trunk/Drivers/ccid/src
Ludovic Rousseau
rousseau at costa.debian.org
Wed Jan 18 10:24:14 UTC 2006
Author: rousseau
Date: 2006-01-18 10:24:09 +0000 (Wed, 18 Jan 2006)
New Revision: 1807
Modified:
trunk/Drivers/ccid/src/ccid_usb.c
Log:
CloseUSB(): free the allocated arrayOfSupportedDataRates only for the
pimary slot. The other slots of the same reader either point to the
same array or point to a statically allocated array.
Modified: trunk/Drivers/ccid/src/ccid_usb.c
===================================================================
--- trunk/Drivers/ccid/src/ccid_usb.c 2006-01-18 09:24:15 UTC (rev 1806)
+++ trunk/Drivers/ccid/src/ccid_usb.c 2006-01-18 10:24:09 UTC (rev 1807)
@@ -517,6 +517,13 @@
usbDevice[reader_index].dev->bus->dirname,
usbDevice[reader_index].dev->filename);
+ if (usbDevice[reader_index].ccid.arrayOfSupportedDataRates
+ && (usbDevice[reader_index].ccid.bCurrentSlotIndex == 0))
+ {
+ free(usbDevice[reader_index].ccid.arrayOfSupportedDataRates);
+ usbDevice[reader_index].ccid.arrayOfSupportedDataRates = NULL;
+ }
+
/* one slot closed */
(*usbDevice[reader_index].nb_opened_slots)--;
@@ -525,9 +532,6 @@
{
DEBUG_COMM("Last slot closed. Release resources");
- if (usbDevice[reader_index].ccid.arrayOfSupportedDataRates)
- free(usbDevice[reader_index].ccid.arrayOfSupportedDataRates);
-
/* reset so that bSeq starts at 0 again */
if (DriverOptions & DRIVER_OPTION_RESET_ON_CLOSE)
usb_reset(usbDevice[reader_index].handle);
More information about the Pcsclite-cvs-commit
mailing list