[pkg-opensc-commit] [libp11] 64/239: fix some memory leaks
Eric Dorland
eric at moszumanska.debian.org
Sat Oct 17 06:21:09 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 9fe2db2341a8cfb798bb27a126be9cf4300d62bc
Author: Nils Larsch <nlarsch at gmx.net>
Date: Fri Oct 21 22:47:26 2005 +0000
fix some memory leaks
---
examples/decrypt.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/examples/decrypt.c b/examples/decrypt.c
index b4ed517..74a46b9 100644
--- a/examples/decrypt.c
+++ b/examples/decrypt.c
@@ -28,9 +28,9 @@ int main(int argc, char *argv[])
PKCS11_KEY *authkey;
PKCS11_CERT *authcert;
- EVP_PKEY *pubkey;
+ EVP_PKEY *pubkey = NULL;
- unsigned char *random, *encrypted, *decrypted;
+ unsigned char *random = NULL, *encrypted = NULL, *decrypted = NULL;
char password[20];
int rc = 0, fd, len;
@@ -206,6 +206,18 @@ int main(int argc, char *argv[])
PKCS11_CTX_unload(ctx);
PKCS11_CTX_free(ctx);
+ if (pubkey != NULL)
+ EVP_PKEY_free(pubkey);
+ if (random != NULL)
+ free(random);
+ if (encrypted != NULL)
+ free(encrypted);
+ if (decrypted != NULL)
+ free(decrypted);
+
+ ERR_free_strings();
+ ERR_remove_state(0);
+
printf("decryption successfull.\n");
return 0;
--
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