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

rousseau at users.alioth.debian.org rousseau at users.alioth.debian.org
Tue Jul 5 20:51:37 UTC 2011


Author: rousseau
Date: Tue Jul  5 20:51:37 2011
New Revision: 5826

URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=5826
Log:
Fix	a REVERSE_INULL coverity error

sContext->pFeeds is checked for NULL _after_ being dereferenced in
RFUnloadReader() called by RFUnInitializeReader().
We now check before dereferencing.

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=5826&op=diff
==============================================================================
--- trunk/PCSC/src/readerfactory.c (original)
+++ trunk/PCSC/src/readerfactory.c Tue Jul  5 20:51:37 2011
@@ -479,17 +479,16 @@
 		if (sContext -> pthThread)
 			(void)EHDestroyEventHandler(sContext);
 
+		if ((NULL == sContext->pMutex) || (NULL == sContext->pFeeds))
+		{
+			Log1(PCSC_LOG_ERROR,
+				"Trying to remove an already removed driver");
+			return SCARD_E_INVALID_VALUE;
+		}
+
 		rv = RFUnInitializeReader(sContext);
 		if (rv != SCARD_S_SUCCESS)
 			return rv;
-
-		/* Destroy and free the mutex */
-		if ((NULL == sContext->pMutex) || (NULL == sContext->pFeeds))
-		{
-			Log1(PCSC_LOG_ERROR,
-				"Trying to remove an already removed driver");
-			return SCARD_E_INVALID_VALUE;
-		}
 
 		*sContext->pMutex -= 1;
 




More information about the Pcsclite-cvs-commit mailing list