[Pcsclite-cvs-commit] r6711 - trunk/PCSC/src

ludovic.rousseau at free.fr ludovic.rousseau at free.fr
Mon Aug 5 18:59:56 UTC 2013


Author: rousseau
Date: 2013-08-05 18:59:56 +0000 (Mon, 05 Aug 2013)
New Revision: 6711

Modified:
   trunk/PCSC/src/eventhandler.c
   trunk/PCSC/src/eventhandler.h
   trunk/PCSC/src/pcscdaemon.c
Log:
Create and use EHDeinitializeEventStructures(): fix memory leak

The structures allocated in EHInitializeEventStructures() were never
released.

Thanks to Alan Kozlay for the patch


Modified: trunk/PCSC/src/eventhandler.c
===================================================================
--- trunk/PCSC/src/eventhandler.c	2013-08-05 18:53:24 UTC (rev 6710)
+++ trunk/PCSC/src/eventhandler.c	2013-08-05 18:59:56 UTC (rev 6711)
@@ -128,6 +128,14 @@
 	return SCARD_S_SUCCESS;
 }
 
+LONG EHDeinitializeEventStructures(void)
+{
+	list_destroy(&ClientsWaitingForEvent);
+	pthread_mutex_destroy(&ClientsWaitingForEvent_lock);
+
+	return SCARD_S_SUCCESS;
+}
+
 LONG EHDestroyEventHandler(READER_CONTEXT * rContext)
 {
 	int rv;

Modified: trunk/PCSC/src/eventhandler.h
===================================================================
--- trunk/PCSC/src/eventhandler.h	2013-08-05 18:53:24 UTC (rev 6710)
+++ trunk/PCSC/src/eventhandler.h	2013-08-05 18:59:56 UTC (rev 6711)
@@ -42,6 +42,7 @@
 	LONG EHUnregisterClientForEvent(int32_t filedes);
 	LONG EHSignalEventToClients(void);
 	LONG EHInitializeEventStructures(void);
+	LONG EHDeinitializeEventStructures(void);
 	LONG EHSpawnEventHandler(READER_CONTEXT *);
 	LONG EHDestroyEventHandler(READER_CONTEXT *);
 

Modified: trunk/PCSC/src/pcscdaemon.c
===================================================================
--- trunk/PCSC/src/pcscdaemon.c	2013-08-05 18:53:24 UTC (rev 6710)
+++ trunk/PCSC/src/pcscdaemon.c	2013-08-05 18:59:56 UTC (rev 6711)
@@ -46,6 +46,7 @@
 #include "configfile.h"
 #include "powermgt_generic.h"
 #include "utils.h"
+#include "eventhandler.h"
 
 #ifndef TRUE
 #define TRUE 1
@@ -96,6 +97,7 @@
 
 			/* now stop all the drivers */
 			RFCleanupReaders();
+			EHDeinitializeEventStructures();
 			ContextsDeinitialize();
 			at_exit();
 		}




More information about the Pcsclite-cvs-commit mailing list