mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-27 22:03:31 +01:00
don't leak memory on pk ops
svn:r117
This commit is contained in:
parent
e7ecd5e1d5
commit
2fa4b5bb53
@ -234,10 +234,9 @@ int crypto_pk_read_private_key_from_file(crypto_pk_env_t *env, FILE *src)
|
|||||||
|
|
||||||
switch(env->type) {
|
switch(env->type) {
|
||||||
case CRYPTO_PK_RSA:
|
case CRYPTO_PK_RSA:
|
||||||
/*
|
|
||||||
if (env->key)
|
if (env->key)
|
||||||
RSA_free((RSA *)env->key);*/
|
RSA_free((RSA *)env->key);
|
||||||
env->key = (unsigned char *)PEM_read_RSAPrivateKey(src, (RSA **)&env->key, NULL, NULL);
|
env->key = (unsigned char *)PEM_read_RSAPrivateKey(src, NULL, NULL, NULL);
|
||||||
if (!env->key)
|
if (!env->key)
|
||||||
return -1;
|
return -1;
|
||||||
break;
|
break;
|
||||||
@ -298,7 +297,9 @@ int crypto_pk_read_public_key_from_file(crypto_pk_env_t *env, FILE *src)
|
|||||||
|
|
||||||
switch(env->type) {
|
switch(env->type) {
|
||||||
case CRYPTO_PK_RSA:
|
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)
|
if (!env->key)
|
||||||
return -1;
|
return -1;
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user