[pkg-opensc-commit] [libp11] 41/51: Corrected memory leak in pkcs11_CTX_free(PKCS11_CTX * ctx)

Eric Dorland eric at moszumanska.debian.org
Wed Dec 7 17:51:33 UTC 2016


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

eric pushed a commit to branch master
in repository libp11.

commit 66ab467ecc744ed301233a528f1ffc2389ef3eb3
Author: nased0 <pw178860 at gmail.com>
Date:   Thu Nov 24 14:34:57 2016 +0100

    Corrected memory leak in pkcs11_CTX_free(PKCS11_CTX * ctx)
    
    I posted the screenshot of the leak at
    https://github.com/OpenSC/libp11/issues/122#issuecomment-257850173
    Now there is no leak in pkcs11.dll (tested with Memory Validator).
    
    Add files via upload
    
    Corrected memory leak in pkcs11_CTX_free v.2
---
 src/p11_load.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/p11_load.c b/src/p11_load.c
index 30e563f..b0e5336 100644
--- a/src/p11_load.c
+++ b/src/p11_load.c
@@ -141,6 +141,7 @@ void pkcs11_CTX_unload(PKCS11_CTX *ctx)
 
 	/* Unload the module */
 	C_UnloadModule(cpriv->handle);
+	cpriv->handle = NULL;
 }
 
 /*
@@ -158,6 +159,9 @@ void pkcs11_CTX_free(PKCS11_CTX *ctx)
 	if (cpriv->init_args) {
 		OPENSSL_free(cpriv->init_args);
 	}
+	if(cpriv->handle) {
+		OPENSSL_free(cpriv->handle);
+	}
 	CRYPTO_THREAD_lock_free(cpriv->rwlock);
 	OPENSSL_free(ctx->manufacturer);
 	OPENSSL_free(ctx->description);

-- 
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