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

rousseau at users.alioth.debian.org rousseau at users.alioth.debian.org
Fri Jan 7 14:45:52 UTC 2011


Author: rousseau
Date: Fri Jan  7 14:45:50 2011
New Revision: 5494

URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=5494
Log:
CloseUSB(): free the serial number string only for the last slot since
they all point to the same string.

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=5494&op=diff
==============================================================================
--- trunk/Drivers/ccid/src/ccid_usb.c (original)
+++ trunk/Drivers/ccid/src/ccid_usb.c Fri Jan  7 14:45:50 2011
@@ -714,6 +714,9 @@
 	{
 		DEBUG_COMM("Last slot closed. Release resources");
 
+		if (usbDevice[reader_index].ccid.sIFD_serial_number)
+			free(usbDevice[reader_index].ccid.sIFD_serial_number);
+
 		/* reset so that bSeq starts at 0 again */
 		if (DriverOptions & DRIVER_OPTION_RESET_ON_CLOSE)
 			(void)libusb_reset_device(usbDevice[reader_index].dev_handle);
@@ -729,9 +732,6 @@
 	/* mark the resource unused */
 	usbDevice[reader_index].dev_handle = NULL;
 	usbDevice[reader_index].interface = 0;
-
-	if (usbDevice[reader_index].ccid.sIFD_serial_number)
-		free(usbDevice[reader_index].ccid.sIFD_serial_number);
 
 	return STATUS_SUCCESS;
 } /* CloseUSB */




More information about the Pcsclite-cvs-commit mailing list