[Pcsclite-cvs-commit] r6635 - /trunk/Drivers/ccid/src/ccid_usb.c

rousseau at users.alioth.debian.org rousseau at users.alioth.debian.org
Fri May 24 13:00:03 UTC 2013


Author: rousseau
Date: Fri May 24 13:00:03 2013
New Revision: 6635

URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=6635
Log:
CloseUSB(): free the gemalto_firmware_features only on the last slot

All the slots of a same reader use the same gemalto_firmware_features
structure. We should only free the structure when the last slot is
closing.

Modified:
    trunk/Drivers/ccid/src/ccid_usb.c

Modified: trunk/Drivers/ccid/src/ccid_usb.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/Drivers/ccid/src/ccid_usb.c?rev=6635&op=diff
==============================================================================
--- trunk/Drivers/ccid/src/ccid_usb.c (original)
+++ trunk/Drivers/ccid/src/ccid_usb.c Fri May 24 13:00:03 2013
@@ -759,12 +759,6 @@
 		usbDevice[reader_index].ccid.arrayOfSupportedDataRates = NULL;
 	}
 
-	if (usbDevice[reader_index].ccid.gemalto_firmware_features)
-	{
-		free(usbDevice[reader_index].ccid.gemalto_firmware_features);
-		usbDevice[reader_index].ccid.gemalto_firmware_features = NULL ;
-	}
-
 	/* one slot closed */
 	(*usbDevice[reader_index].nb_opened_slots)--;
 
@@ -772,6 +766,9 @@
 	if (0 == *usbDevice[reader_index].nb_opened_slots)
 	{
 		DEBUG_COMM("Last slot closed. Release resources");
+
+		if (usbDevice[reader_index].ccid.gemalto_firmware_features)
+			free(usbDevice[reader_index].ccid.gemalto_firmware_features);
 
 		if (usbDevice[reader_index].ccid.sIFD_serial_number)
 			free(usbDevice[reader_index].ccid.sIFD_serial_number);




More information about the Pcsclite-cvs-commit mailing list