[Pcsclite-cvs-commit] r6042 - /trunk/PCSC/src/spy/pcsc-spy.c
rousseau at users.alioth.debian.org
rousseau at users.alioth.debian.org
Sat Oct 15 16:20:43 UTC 2011
Author: rousseau
Date: Sat Oct 15 16:20:43 2011
New Revision: 6042
URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=6042
Log:
Use a global symbol for the library handle
Make coverity more happy
leaked_storage: Variable "handle" going out of scope leaks the
storage it points to.
noescape: Variable "handle" is not freed or pointed-to in function "dlsym".
Modified:
trunk/PCSC/src/spy/pcsc-spy.c
Modified: trunk/PCSC/src/spy/pcsc-spy.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/spy/pcsc-spy.c?rev=6042&op=diff
==============================================================================
--- trunk/PCSC/src/spy/pcsc-spy.c (original)
+++ trunk/PCSC/src/spy/pcsc-spy.c Sat Oct 15 16:20:43 2011
@@ -129,6 +129,7 @@
#define LOG log_line("%s:%d", __FILE__, __LINE__)
static int Log_fd = -1;
+static void *Lib_handle = NULL;
#ifdef DEBUG
static void log_line(const char *fmt, ...)
@@ -304,7 +305,6 @@
static LONG load_lib(void)
{
- void *handle;
#define LIBPCSC_NOSPY "libpcsclite_nospy.so.1"
#define LIBPCSC "libpcsclite.so.1"
@@ -312,21 +312,21 @@
/* first try to load the NOSPY library
* this is used for programs doing an explicit dlopen like
* Perl and Python wrappers */
- handle = dlopen(LIBPCSC_NOSPY, RTLD_LAZY);
- if (NULL == handle)
+ Lib_handle = dlopen(LIBPCSC_NOSPY, RTLD_LAZY);
+ if (NULL == Lib_handle)
{
log_line("%s", dlerror());
/* load the normal library */
- handle = dlopen(LIBPCSC, RTLD_LAZY);
- if (NULL == handle)
+ Lib_handle = dlopen(LIBPCSC, RTLD_LAZY);
+ if (NULL == Lib_handle)
{
log_line("%s", dlerror());
return SCARD_F_INTERNAL_ERROR;
}
}
-#define get_symbol(s) do { spy.s = dlsym(handle, #s); if (NULL == spy.s) { log_line("%s", dlerror()); return SCARD_F_INTERNAL_ERROR; } } while (0)
+#define get_symbol(s) do { spy.s = dlsym(Lib_handle, #s); if (NULL == spy.s) { log_line("%s", dlerror()); return SCARD_F_INTERNAL_ERROR; } } while (0)
get_symbol(SCardEstablishContext);
get_symbol(SCardReleaseContext);
More information about the Pcsclite-cvs-commit
mailing list