diff options
author | rch@chromium.org <rch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-01 22:02:33 +0000 |
---|---|---|
committer | rch@chromium.org <rch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-01 22:02:33 +0000 |
commit | 34b1289eb33a88631bbf8dc61febfe31ef3a9235 (patch) | |
tree | a40f168dde2b9009d73365962f1e769ef39c5723 /crypto/ec_signature_creator.cc | |
parent | 6d5237734cca74c9f8f1390cbfcb6cf51e92b808 (diff) | |
download | chromium_src-34b1289eb33a88631bbf8dc61febfe31ef3a9235.zip chromium_src-34b1289eb33a88631bbf8dc61febfe31ef3a9235.tar.gz chromium_src-34b1289eb33a88631bbf8dc61febfe31ef3a9235.tar.bz2 |
Add a DCHECK to ECSignatureCreator::SetFactoryForTesting to help avoid use-after-free problems.
Review URL: https://chromiumcodereview.appspot.com/10828118
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@149506 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'crypto/ec_signature_creator.cc')
-rw-r--r-- | crypto/ec_signature_creator.cc | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/crypto/ec_signature_creator.cc b/crypto/ec_signature_creator.cc index cbaa820..a6887bc 100644 --- a/crypto/ec_signature_creator.cc +++ b/crypto/ec_signature_creator.cc @@ -4,6 +4,7 @@ #include "crypto/ec_signature_creator.h" +#include "base/logging.h" #include "crypto/ec_signature_creator_impl.h" namespace crypto { @@ -24,6 +25,9 @@ ECSignatureCreator* ECSignatureCreator::Create(ECPrivateKey* key) { // static void ECSignatureCreator::SetFactoryForTesting( ECSignatureCreatorFactory* factory) { + // We should always clear the factory after each test to avoid + // use-after-free problems. + DCHECK(!g_factory_ || !factory); g_factory_ = factory; } |