aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2002-09-27 22:13:22 +0000
committerRoger Dingledine <arma@torproject.org>2002-09-27 22:13:22 +0000
commit2fa4b5bb53b3a4f51daaf2d59c612846d688dc18 (patch)
tree69d224ecb6b1c773dd3858be2fb517e25948774d /src
parente7ecd5e1d595e08ac9fa90896b0c76b70f4e7944 (diff)
downloadtor-2fa4b5bb53b3a4f51daaf2d59c612846d688dc18.tar
tor-2fa4b5bb53b3a4f51daaf2d59c612846d688dc18.tar.gz
don't leak memory on pk ops
svn:r117
Diffstat (limited to 'src')
-rw-r--r--src/common/crypto.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/common/crypto.c b/src/common/crypto.c
index abb3344d2..bbf3657d0 100644
--- a/src/common/crypto.c
+++ b/src/common/crypto.c
@@ -234,10 +234,9 @@ int crypto_pk_read_private_key_from_file(crypto_pk_env_t *env, FILE *src)
switch(env->type) {
case CRYPTO_PK_RSA:
-/*
if (env->key)
- RSA_free((RSA *)env->key);*/
- env->key = (unsigned char *)PEM_read_RSAPrivateKey(src, (RSA **)&env->key, NULL, NULL);
+ RSA_free((RSA *)env->key);
+ env->key = (unsigned char *)PEM_read_RSAPrivateKey(src, NULL, NULL, NULL);
if (!env->key)
return -1;
break;
@@ -298,7 +297,9 @@ int crypto_pk_read_public_key_from_file(crypto_pk_env_t *env, FILE *src)
switch(env->type) {
case CRYPTO_PK_RSA:
- env->key = (unsigned char *)PEM_read_RSAPublicKey(src, (RSA **)&env->key, NULL, NULL);
+ if(env->key)
+ RSA_free((RSA *)env->key);
+ env->key = (unsigned char *)PEM_read_RSAPublicKey(src, NULL, NULL, NULL);
if (!env->key)
return -1;
break;