Memory leakage of rsa_new and rsa_free in OpenSSL)

Source: Internet
Author: User

Transferred from: bytes.

When using RSA encryption and decryption of OpenSSL, it is found that there will still be Memory leakage after rsa_new () initialization and rsa_free () Release of the RSA struct.My OpenSSL version is 0.9.8l.
The details are as follows:
RSA * RSA = rsa_new ();
Rsa_free (RSA );
The solution is simple: Call the crypto library of OpenSSL and call the API before exiting: Crypto_cleanup_all_ex_dat To clear the data in the global hash table that manages crypto_ex_data to avoid Memory leakage. As follows:
RSA * RSA = rsa_new ();
Rsa_free (RSA );
crypto_cleanup_all_ex_data ();
note that crypto_cleanup_all_ex_data () cannot be called under the potential race-conditions condition.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.