[pkg-opensc-commit] [opensc] 127/295: libpkcs11: Prevent double-free when the dlopen fails

Eric Dorland eric at moszumanska.debian.org
Sat Jun 24 21:11:23 UTC 2017


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

eric pushed a commit to branch master
in repository opensc.

commit 24346062c01ad690addb0db55b74f9c53b394c0c
Author: Jakub Jelen <jjelen at redhat.com>
Date:   Mon Nov 21 10:53:41 2016 +0100

    libpkcs11: Prevent double-free when the dlopen fails
---
 src/common/libpkcs11.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/common/libpkcs11.c b/src/common/libpkcs11.c
index 302496f..1823eef 100644
--- a/src/common/libpkcs11.c
+++ b/src/common/libpkcs11.c
@@ -56,10 +56,12 @@ C_LoadModule(const char *mspec, CK_FUNCTION_LIST_PTR_PTR funcs)
 	rv = c_get_function_list(funcs);
 	if (rv == CKR_OK)
 		return (void *) mod;
-	else
+	else {
 		fprintf(stderr, "C_GetFunctionList failed %lx", rv);
+		C_UnloadModule((void *) mod);
+		return NULL;
+	}
 failed:
-	C_UnloadModule((void *) mod);
 	free(mod);
 	return NULL;
 }

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



More information about the pkg-opensc-commit mailing list