[Pcsclite-cvs-commit] r5152 - /trunk/PCSC/src/hotplug_libusb.c
rousseau at users.alioth.debian.org
rousseau at users.alioth.debian.org
Tue Aug 17 09:13:58 UTC 2010
Author: rousseau
Date: Tue Aug 17 09:13:55 2010
New Revision: 5152
URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=5152
Log:
HPSearchHotPluggables(): create the synchronisation pipe only if the
HPEstablishUSBNotifications thread is created.
Avoids to leak resources.
Modified:
trunk/PCSC/src/hotplug_libusb.c
Modified: trunk/PCSC/src/hotplug_libusb.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/hotplug_libusb.c?rev=5152&op=diff
==============================================================================
--- trunk/PCSC/src/hotplug_libusb.c (original)
+++ trunk/PCSC/src/hotplug_libusb.c Tue Aug 17 09:13:55 2010
@@ -423,8 +423,6 @@
LONG HPSearchHotPluggables(void)
{
int i;
- int pipefd[2];
- char c;
for (i=0; i<PCSCLITE_MAX_READERS_CONTEXTS; i++)
{
@@ -433,14 +431,17 @@
readerTracker[i].fullName = NULL;
}
- if (pipe(pipefd) == -1)
- {
- Log2(PCSC_LOG_ERROR, "pipe: %s", strerror(errno));
- return -1;
- }
-
if (HPReadBundleValues())
{
+ int pipefd[2];
+ char c;
+
+ if (pipe(pipefd) == -1)
+ {
+ Log2(PCSC_LOG_ERROR, "pipe: %s", strerror(errno));
+ return -1;
+ }
+
ThreadCreate(&usbNotifyThread, THREAD_ATTR_DETACHED,
(PCSCLITE_THREAD_FUNCTION( )) HPEstablishUSBNotifications, pipefd);
More information about the Pcsclite-cvs-commit
mailing list