diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2011-10-10 14:09:05 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2011-10-10 14:09:05 +0000 |
commit | 4874e235fb15891d0cf024d52ebcd758cfb83ece (patch) | |
tree | 5165c8a0837909467106c8c46f0737c42a490b0f | |
parent | 06afa6eb94bdff69226600db718aa64eb565f867 (diff) |
fix leak properly this time...
-rw-r--r-- | crypto/engine/eng_rsax.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/crypto/engine/eng_rsax.c b/crypto/engine/eng_rsax.c index ef29f33edc..c73fb21995 100644 --- a/crypto/engine/eng_rsax.c +++ b/crypto/engine/eng_rsax.c @@ -307,12 +307,17 @@ static E_RSAX_MOD_CTX *e_rsax_get_ctx(RSA *rsa, int idx, BIGNUM* m) static int e_rsax_rsa_finish(RSA *rsa) { E_RSAX_MOD_CTX *hptr = RSA_get_ex_data(rsa, rsax_ex_data_idx); - if(!hptr) return 0; - - OPENSSL_free(hptr); - RSA_set_ex_data(rsa, rsax_ex_data_idx, NULL); - if (def_rsa_finish) - def_rsa_finish(rsa); + if(hptr) + { + OPENSSL_free(hptr); + RSA_set_ex_data(rsa, rsax_ex_data_idx, NULL); + } + if (rsa->_method_mod_n) + BN_MONT_CTX_free(rsa->_method_mod_n); + if (rsa->_method_mod_p) + BN_MONT_CTX_free(rsa->_method_mod_p); + if (rsa->_method_mod_q) + BN_MONT_CTX_free(rsa->_method_mod_q); return 1; } |