fix leak properly this time...
authorDr. Stephen Henson <steve@openssl.org>
Mon, 10 Oct 2011 14:09:05 +0000 (14:09 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Mon, 10 Oct 2011 14:09:05 +0000 (14:09 +0000)
crypto/engine/eng_rsax.c

index ef29f33edca8f31417095967ed80ab496108432d..c73fb21995e7e800bc1fecf9de5d2049bc01342b 100644 (file)
@@ -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;
        }