[pkg-opensc-commit] [pkcs11-helper] 16/60: win32 crypto engine cleanups

Eric Dorland eric at moszumanska.debian.org
Fri Jan 6 23:39:42 UTC 2017


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

eric pushed a commit to tag pkcs11-helper-1.02
in repository pkcs11-helper.

commit 546a47c05057868a80d202a649a4cd3049a341cf
Author: alonbl <alonbl at 485eb718-1723-0410-b8a9-88cf21a28c35>
Date:   Tue Nov 28 06:07:14 2006 +0000

    win32 crypto engine cleanups
---
 lib/pkcs11h-crypto.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/lib/pkcs11h-crypto.c b/lib/pkcs11h-crypto.c
index 1db40a5..1c5768b 100644
--- a/lib/pkcs11h-crypto.c
+++ b/lib/pkcs11h-crypto.c
@@ -343,7 +343,7 @@ pkcs11h_engine_crypto_t g_pkcs11h_crypto_engine = {
 	__pkcs11h_crypto_gnutls_certificate_is_issuer
 };
 #elif defined(ENABLE_PKCS11H_ENGINE_WIN32)
-static struct __crypto_win32_data_s s_win32_data;
+static struct __crypto_win32_data_s s_win32_data = { NULL };
 pkcs11h_engine_crypto_t g_pkcs11h_crypto_engine = {
 	&s_win32_data,
 	__pkcs11h_crypto_win32_initialize,
@@ -917,7 +917,7 @@ __pkcs11h_crypto_win32_initialize (
 
 	PKCS11H_ASSERT (global_data!=NULL);
 
-	memset (data, 0, sizeof (struct __crypto_win32_data_s));
+	__pkcs11h_crypto_win32_uninitialize (data);
 
 	data->handle = LoadLibraryA ("crypt32.dll");
 	if (data->handle == NULL) {
@@ -952,8 +952,7 @@ __pkcs11h_crypto_win32_initialize (
 		data->p_CryptDecodeObject == NULL ||
 		data->p_CryptVerifyCertificateSignatureEx == NULL
 	) {
-		FreeLibrary (data->handle);
-		data->handle = NULL;
+		__pkcs11h_crypto_win32_uninitialize (data);
 		return 0;
 	}
 
@@ -974,6 +973,8 @@ __pkcs11h_crypto_win32_uninitialize (
 		data->handle = NULL;
 	}
 
+	memset (data, 0, sizeof (struct __crypto_win32_data_s));
+
 	return 1;
 }
 

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



More information about the pkg-opensc-commit mailing list