[Pcsclite-git-commit] [CCID] 01/01: OpenUSBByName(): free the device list in case of error

Ludovic Rousseau rousseau at moszumanska.debian.org
Thu Sep 17 15:45:56 UTC 2015


This is an automated email from the git hooks/post-receive script.

rousseau pushed a commit to branch master
in repository CCID.

commit 4cb29aac717b00bda5e97c9f26eb82279c1f9514
Author: Ludovic Rousseau <ludovic.rousseau at free.fr>
Date:   Thu Sep 17 14:16:21 2015 +0200

    OpenUSBByName(): free the device list in case of error
    
    If no reader is found the code should release the device list in any
    case.
    
    Either the code will try again to find the reader (in case of Mac OS X)
    or return an error code.
    
    The list of USB devices shall always be released before returning from the
    function (in error or normal cases).
---
 src/ccid_usb.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/ccid_usb.c b/src/ccid_usb.c
index c0bacc5..c28fe21 100644
--- a/src/ccid_usb.c
+++ b/src/ccid_usb.c
@@ -698,6 +698,9 @@ again:
 end:
 	if (usbDevice[reader_index].dev_handle == NULL)
 	{
+		/* free the libusb allocated list & devices */
+		libusb_free_device_list(devs, 1);
+
 #ifdef __APPLE__
 		/* give some time to libusb to detect the new USB devices on Mac OS X */
 		if (count_libusb > 0)
@@ -706,9 +709,6 @@ end:
 			DEBUG_INFO2("Wait after libusb: %d", count_libusb);
 			nanosleep(&sleep_time, NULL);
 
-			/* free the libusb allocated list & devices */
-			libusb_free_device_list(devs, 1);
-
 			goto again_libusb;
 		}
 #endif

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pcsclite/CCID.git



More information about the Pcsclite-cvs-commit mailing list