[Pcsclite-cvs-commit] r4753 - /trunk/PCSC/src/readerfactory.c

rousseau at users.alioth.debian.org rousseau at users.alioth.debian.org
Fri Feb 12 10:17:54 UTC 2010


Author: rousseau
Date: Fri Feb 12 10:17:53 2010
New Revision: 4753

URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=4753
Log:
RFRemoveReader(): simplify/factorise the resources deallocation

Modified:
    trunk/PCSC/src/readerfactory.c

Modified: trunk/PCSC/src/readerfactory.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/readerfactory.c?rev=4753&op=diff
==============================================================================
--- trunk/PCSC/src/readerfactory.c (original)
+++ trunk/PCSC/src/readerfactory.c Fri Feb 12 10:17:53 2010
@@ -457,19 +457,15 @@
 			return SCARD_E_INVALID_VALUE;
 		}
 
+		*sContext->pMutex -= 1;
+
 		/* free shared resources when the last slot is closed */
-		if (*sContext->pMutex == 1)
+		if (0 == *sContext->pMutex)
 		{
 			(void)SYS_MutexDestroy(sContext->mMutex);
 			free(sContext->mMutex);
 			free(sContext->lpcLibrary);
 			free(sContext->lpcDevice);
-		}
-
-		*sContext->pMutex -= 1;
-
-		if (*sContext->pMutex == 0)
-		{
 			free(sContext->pMutex);
 			sContext->pMutex = NULL;
 		}
@@ -477,7 +473,6 @@
 		*sContext->pFeeds -= 1;
 
 		/* Added by Dave to free the pFeeds variable */
-
 		if (*sContext->pFeeds == 0)
 		{
 			free(sContext->pFeeds);




More information about the Pcsclite-cvs-commit mailing list