Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3147)

Unified Diff: crypto/rsa_private_key_openssl.cc

Issue 392653005: Fix memory leaks when calling EVP_PKEY_get1_RSA. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | crypto/signature_creator_openssl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: crypto/rsa_private_key_openssl.cc
diff --git a/crypto/rsa_private_key_openssl.cc b/crypto/rsa_private_key_openssl.cc
index bd00a7382aa14478d77836918a873fb1cd8b6fc6..e3cf04c9bb3e7e8611a684329a64bc1a98eee118 100644
--- a/crypto/rsa_private_key_openssl.cc
+++ b/crypto/rsa_private_key_openssl.cc
@@ -107,11 +107,11 @@ RSAPrivateKey::~RSAPrivateKey() {
RSAPrivateKey* RSAPrivateKey::Copy() const {
scoped_ptr<RSAPrivateKey> copy(new RSAPrivateKey());
- RSA* rsa = EVP_PKEY_get1_RSA(key_);
+ ScopedRSA rsa(EVP_PKEY_get1_RSA(key_));
if (!rsa)
return NULL;
copy->key_ = EVP_PKEY_new();
- if (!EVP_PKEY_set1_RSA(copy->key_, rsa))
+ if (!EVP_PKEY_set1_RSA(copy->key_, rsa.get()))
return NULL;
return copy.release();
}
« no previous file with comments | « no previous file | crypto/signature_creator_openssl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698