[pkg-opensc-commit] [libp11] 184/239: Fix crash on attempting to load non-existent module

Eric Dorland eric at moszumanska.debian.org
Sat Oct 17 06:21:31 UTC 2015


This is an automated email from the git hooks/post-receive script.

eric pushed a commit to branch master
in repository libp11.

commit 144f371b1fca107da6790db4ed2944b2e1bdf6e8
Author: David Woodhouse <David.Woodhouse at intel.com>
Date:   Wed Dec 17 13:19:07 2014 +0000

    Fix crash on attempting to load non-existent module
    
    Calling dlclose(NULL) on the error path is not so helpful.
    
    Signed-off-by: David Woodhouse <David.Woodhouse at intel.com>
---
 src/libpkcs11.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/libpkcs11.c b/src/libpkcs11.c
index 93584d9..b02b31d 100644
--- a/src/libpkcs11.c
+++ b/src/libpkcs11.c
@@ -114,11 +114,13 @@ C_UnloadModule(void *module)
 	if (!mod || mod->_magic != MAGIC)
 		return CKR_ARGUMENTS_BAD;
 
+	if (mod->handle) {
 #ifdef WIN32
-	FreeLibrary(mod->handle);
+		FreeLibrary(mod->handle);
 #else
-	dlclose(mod->handle);
+		dlclose(mod->handle);
 #endif
+	}
 
 	memset(mod, 0, sizeof(*mod));
 	free(mod);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-opensc/libp11.git



More information about the pkg-opensc-commit mailing list